Repository navigation
[NativeAOT] Fix a stress crash in thread detach at process shutdown. - #73912
Merged
Merged
Conversation
Member
Author
|
This crash/assert is such a nuisance when running libraries tests as a stress test. |
jkotas
reviewed
Aug 14, 2022
| return; | ||
| } | ||
|
|
||
| pDetachingThread->Detach(); |
Member
There was a problem hiding this comment.
We are going to skip FixAllocContext here. Is it going to cause problems/asserts with GC accounting if the GC manages to sneak in before the process actually exits?
Would it be better to only skip Thread::Destroy, but keep Thread::Detach?
Member
Author
There was a problem hiding this comment.
It would probably only affect statistics like total alloc bytes if someone manages to query for that before the exit.
We may as well call Thread::Detach. It is not a lot of savings if we don't.
jkotas
approved these changes
Aug 14, 2022
Member
Author
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
the failure on arm64 is #13757 |
Member
Author
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes: #73116
At shutdown we allow some threads to terminate without removing themselves from the thread list. Once a TLS of such thread is released, the thread list becomes corrupted, so whoever iterates the list now or later crashes.
Since we cannot be sure that every thread is promptly aware that we are shutting down, we cannot let threads to exit without removing themselves from the thread list first.