Open blair-ahlquist opened 2 years ago
Hmm... I went back to this after encountering similar issues with code using SemaphoreSlim
. The above code eventually completes after over a minute!
I haven't had a chance to run this yet, but that is what I suspected.
This isn't a deadlock, but it is the result of thread pool exhaustion. All the AsyncEx primitives (as well as SemaphoreSlim
) require a free thread pool thread to unlock, and if all the thread pool threads are busy waiting, this can cause extremely slow progress. The thread pool will (eventually) add another thread, which is then used either to block immediately (enterReadThenWrite
), or used to unlock one of the primitives and then blocked immediately.
As such, this is a duplicate of #107, which I am planning to fix eventually, but haven't yet had time.
The following code deadlocks: