-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[NativeAOT] Fix a stress crash in thread detach at process shutdown. #73912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This crash/assert is such a nuisance when running libraries tests as a stress test. |
| return; | ||
| } | ||
|
|
||
| pDetachingThread->Detach(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
the failure on arm64 is #13757 |
|
Thanks! |
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.