This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author arekm
Recipients BTaskaya, arekm, gaborjbernat, pablogsal, vstinner
Date 2020-03-15.09:40:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1584265236.67.0.562355190721.issue39360@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-03-15 09:40:36arekmsetrecipients: + arekm, vstinner, pablogsal, gaborjbernat, BTaskaya
2020-03-15 09:40:36arekmsetmessageid: <1584265236.67.0.562355190721.issue39360@roundup.psfhosted.org>
2020-03-15 09:40:36arekmlinkissue39360 messages
2020-03-15 09:40:36arekmcreate