Skip to content

Conversation

@lambdageek
Copy link
Member

Revert #46390 which reverted the Mono parts of #46244.

Fixes #46389

The issue was that the code in #46244 throws in Thread constructors before calling Initialize. Which will then cause a finalizer to run on a partially-initialized thread object, which means that ves_icall_System_Threading_InternalThread_Thread_free_internal will be called with a null MonoInternalThread:longlived field.

This might happen on netcore if the managed Thread constructor throws an
exception before calling InitInternal.  In that case the finalizer may see a
partially initialized object.
Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@jkotas jkotas merged commit ce4c725 into dotnet:master Jan 13, 2021
@lambdageek lambdageek deleted the hack-un-revert-gh-46244 branch January 13, 2021 14:17
@ghost ghost locked as resolved and limited conversation to collaborators Feb 12, 2021
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.

Intermittent failures in System.Threading.Thread tests on Mono

3 participants