Skip to content

Conversation

@VSadov
Copy link
Member

@VSadov VSadov commented Aug 14, 2022

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.

@ghost ghost assigned VSadov Aug 14, 2022
@VSadov VSadov requested review from janvorli and jkotas August 14, 2022 04:18
@VSadov
Copy link
Member Author

VSadov commented Aug 14, 2022

This crash/assert is such a nuisance when running libraries tests as a stress test.
It may not show up for a while and then produce a bunch of core dumps.

return;
}

pDetachingThread->Detach();
Copy link
Member

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?

Copy link
Member Author

@VSadov VSadov Aug 14, 2022

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.

@VSadov
Copy link
Member Author

VSadov commented Aug 14, 2022

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dotnet dotnet deleted a comment from azure-pipelines bot Aug 14, 2022
@VSadov
Copy link
Member Author

VSadov commented Aug 14, 2022

the failure on arm64 is #13757

@VSadov
Copy link
Member Author

VSadov commented Aug 14, 2022

Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Sep 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NativeAOT] Stress crash in ThreadStore::DetachCurrentThread

2 participants