nunit: Reproducible hang with no user code when shutting down threads
I’m finally tackling a longstanding hang issue with our CI builds at work. What makes me sure that this is an NUnit bug is that whenever the tests hang and I attach a debugger, there is no user code in any thread’s call stack. There are always between 5 and 7 worker threads, blocked on the following call:
mscorlib.dll!System.Threading.ManualResetEventSlim.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)
nunit.framework.dll!NUnit.Framework.Internal.Execution.WorkItemQueue.Dequeue()
nunit.framework.dll!NUnit.Framework.Internal.Execution.TestWorker.TestWorkerThreadProc()
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart()
[Native to Managed Transition]
The fact that there are always fewer than 9 threads would seem to indicate that NUnit is in the process of shutdown from the normal eight plus an STA thread every time this happens. At least two worker threads have shut down in every case I’ve seen so far.
I have a project that reproduces the problem around 2% of the time. It’s still 39 tests. I’m in the process of trying to remove things.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 45