This is related to #90363.
In #30470, the (partial) fix for that issue I wrote:
There are still potential race conditions between checking if any workers are alive and reading from the output queue. This means that there can be up to an extra 30 second delay (instead of an hanging forever), while waiting for self.output.get().
We are now seeing that 30 second delay when running some tests with the GIL disabled, such as test_regrtest.
I think it's worth pursuing the approach used here, which avoids the race condition by tracking exiting workers by passing a sentinel value through the queue:
colesbury/nogil@406e5d7
Linked PRs