Open jkotas opened 1 month ago
The problem is not limited to Thread.Join
. Majority of Thread
APIs that are implemented using FCalls or QCalls suffer from this issue.
Tagging subscribers to this area: @mangod9 See info in area-owners.md if you want to be subscribed.
Deterministic repro
Sleep(1000)
added here: https://github.com/dotnet/runtime/blob/ad430a1d1c6b4016aedd63d15d3089291dced322/src/coreclr/vm/comsynchronizable.cpp#L719gflags
Helper.Initialize();
new Thread(Work).Start();
GC.Collect(); GC.WaitForPendingFinalizers();
Thread.Sleep(3000);
static void Work() { for (;;) { if (Helper.ResurectedThread != null) { Helper.ResurectedThread.Join(1); } } }
class Helper { public static volatile Thread ResurectedThread;
}
Assert failure(PID 23336 [0x00005b28], Thread: 21216 [0x52e0]): Consistency check failed: AV in clr at this callstack:
CORECLR! DoJoin + 0x2C3 (0x00007ffa
175c9d83) CORECLR! ThreadNative_Join + 0x15B (0x00007ffa
175cd87b).AV on tid=0x52e0 (21216), cxr=0000009F9477E6C0, exr=0000009F9477EBB0