[Python-checkins] cpython (merge 3.2 -> default): Merge with 3.2 for #12364.

ross.lagerwall python-checkins at python.org
Sun Jan 8 07:43:53 CET 2012


http://hg.python.org/cpython/rev/25f879011102
changeset:   74300:25f879011102
parent:      74298:c68426b241ca
parent:      74299:26389e9efa9c
user:        Ross Lagerwall <rosslagerwall at gmail.com>
date:        Sun Jan 08 08:42:03 2012 +0200
summary:
  Merge with 3.2 for #12364.

files:
  Lib/concurrent/futures/process.py   |  3 ---
  Lib/test/test_concurrent_futures.py |  6 ++++++
  Misc/NEWS                           |  4 ++++
  3 files changed, 10 insertions(+), 3 deletions(-)


diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py
--- a/Lib/concurrent/futures/process.py
+++ b/Lib/concurrent/futures/process.py
@@ -273,9 +273,6 @@
                 if not pending_work_items:
                     shutdown_worker()
                     return
-                else:
-                    # Start shutting down by telling a process it can exit.
-                    call_queue.put_nowait(None)
             except Full:
                 # This is not a problem: we will eventually be woken up (in
                 # result_queue.get()) and be able to send a sentinel again.
diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py
--- a/Lib/test/test_concurrent_futures.py
+++ b/Lib/test/test_concurrent_futures.py
@@ -109,6 +109,12 @@
         self.assertFalse(err)
         self.assertEqual(out.strip(), b"apple")
 
+    def test_hang_issue12364(self):
+        fs = [self.executor.submit(time.sleep, 0.1) for _ in range(50)]
+        self.executor.shutdown()
+        for f in fs:
+            f.result()
+
 
 class ThreadPoolShutdownTest(ThreadPoolMixin, ExecutorShutdownTest):
     def _prime_executor(self):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -422,6 +422,10 @@
 Library
 -------
 
+- Issue #12364: Fix a hang in concurrent.futures.ProcessPoolExecutor.
+  The hang would occur when retrieving the result of a scheduled future after
+  the executor had been shut down.
+
 - Issue #13502: threading: Fix a race condition in Event.wait() that made it
   return False when the event was set and cleared right after.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list