-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Fix Monitor.Wait
unregistration in CoreCLR upon a thread exiting
#112797
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
Moved the Monitor wait unregistration to happen just before the thread exits, since the wait info is allocated on the stack. Monitor waits are not typically unregistered here, but there can be some odd cases.
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.
Copilot reviewed 1 out of 3 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- src/coreclr/vm/threads.cpp: Language not supported
- src/coreclr/vm/threads.h: Language not supported
Tagging subscribers to this area: @mangod9 |
Assume this is a presumptive fix for #97034.? |
@@ -930,6 +930,7 @@ HRESULT Thread::DetachThread(BOOL fDLLThreadDetach) | |||
m_ThreadHandleForClose = hThread; | |||
} | |||
|
|||
UnregisterWaitEventLinks(); |
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.
can this be called from CooperativeCleanup
?
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.
CooperativeCleanup
seemingly intends to do cleanup in cooperative GC mode, which is not necessary for cleaning up the wait event links.
It seems unlikely given how corner a case it would be (exiting a thread abruptly during a wait). A similar crash could occur in such a case, though it could also occur due to memory corruption or something else abnormal. |
Moved the Monitor wait unregistration to happen just before the thread exits, since the wait info is allocated on the stack. Monitor waits are not typically unregistered here, but there can be some odd cases.