Message364225
I've applied pull request patch (which looks a bit weird to me, removes something then adds the same thing back etc https://patch-diff.githubusercontent.com/raw/python/cpython/pull/19009.patch). Essentially the change is:
diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py
index b223d6aa72..8bd9608b0e 100644
--- a/Lib/multiprocessing/pool.py
+++ b/Lib/multiprocessing/pool.py
@@ -682,7 +682,15 @@ class Pool(object):
# this is guaranteed to only be called once
util.debug('finalizing pool')
- worker_handler._state = TERMINATE
+ # Explicitly do the cleanup here if it didn't come from terminate()
+ # (required for if the queue will block, if it is already closed)
+ if worker_handler._state != TERMINATE:
+ # Notify that the worker_handler state has been changed so the
+ # _handle_workers loop can be unblocked (and exited) in order to
+ # send the finalization sentinel all the workers.
+ worker_handler._state = TERMINATE
+ change_notifier.put(None)
+
task_handler._state = TERMINATE
util.debug('helping task handler/workers to finish')
Unfortunately test case from first message in this bug report still hangs for me with this applied. |
|
Date |
User |
Action |
Args |
2020-03-15 09:40:36 | arekm | set | recipients:
+ arekm, vstinner, pablogsal, gaborjbernat, BTaskaya |
2020-03-15 09:40:36 | arekm | set | messageid: <1584265236.67.0.562355190721.issue39360@roundup.psfhosted.org> |
2020-03-15 09:40:36 | arekm | link | issue39360 messages |
2020-03-15 09:40:36 | arekm | create | |
|