Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 69f39a5

Browse files
committed
Merge with 3.2 for #12364.
2 parents 7540427 + 66e2fb6 commit 69f39a5

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

Lib/concurrent/futures/process.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,6 @@ def shutdown_worker():
273273
if not pending_work_items:
274274
shutdown_worker()
275275
return
276-
else:
277-
# Start shutting down by telling a process it can exit.
278-
call_queue.put_nowait(None)
279276
except Full:
280277
# This is not a problem: we will eventually be woken up (in
281278
# result_queue.get()) and be able to send a sentinel again.

Lib/test/test_concurrent_futures.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ def test_interpreter_shutdown(self):
109109
self.assertFalse(err)
110110
self.assertEqual(out.strip(), b"apple")
111111

112+
def test_hang_issue12364(self):
113+
fs = [self.executor.submit(time.sleep, 0.1) for _ in range(50)]
114+
self.executor.shutdown()
115+
for f in fs:
116+
f.result()
117+
112118

113119
class ThreadPoolShutdownTest(ThreadPoolMixin, ExecutorShutdownTest):
114120
def _prime_executor(self):

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,10 @@ Core and Builtins
422422
Library
423423
-------
424424

425+
- Issue #12364: Fix a hang in concurrent.futures.ProcessPoolExecutor.
426+
The hang would occur when retrieving the result of a scheduled future after
427+
the executor had been shut down.
428+
425429
- Issue #13502: threading: Fix a race condition in Event.wait() that made it
426430
return False when the event was set and cleared right after.
427431

0 commit comments

Comments
 (0)