You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When inserting workitems into threadpool queues, we must always
guarantee that for every workitem there will be some worker at some
point in the future that will certainly notice the presence of the
workitem and executes it.
There was an attempt to relax the requirements in #100506.
Sadly, it leads to occasional deadlocks when items are present in the
work queues and no workers are coming to pick them up.
The same change was made in all 3 threadpools - IO completion, Sockets
and the general purpose ThreadPool. The fix is applied to all three
threadpools.
We have seen reports about deadlocks when running on net9 or later
releases:
- In Windows IO completion: #121608
- In general purpose ThreadPool: #119043
- In Unix Sockets: No known reports so far. Perhaps we have not yet seen
a case where adding more workitems is indirectly conditioned on existing
workitems executed. Without that incoming workitems may "unwedge" the
threadpool, and it is just a pause vs. a deadlock, so could be
unnoticed.
The fix will need to be ported to net10 and net9. Thus this PR tries to
restore just the part which changed the enqueuers/workers handshake
algorithm.
More stuff was piled up into threadpool since the change, so doing the
minimal fix without disturbing the rest is somewhat tricky.
Fixes: #121608 (definitely, I have tried with the repro)
Fixes: #119043 (likely, I do not have a repro to try, but symptoms seem
like from the same issue)
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
0 commit comments