Merge with 3.2 for #12364.
This commit is contained in:
commit
69f39a53f6
|
@ -273,9 +273,6 @@ def _queue_management_worker(executor_reference,
|
||||||
if not pending_work_items:
|
if not pending_work_items:
|
||||||
shutdown_worker()
|
shutdown_worker()
|
||||||
return
|
return
|
||||||
else:
|
|
||||||
# Start shutting down by telling a process it can exit.
|
|
||||||
call_queue.put_nowait(None)
|
|
||||||
except Full:
|
except Full:
|
||||||
# This is not a problem: we will eventually be woken up (in
|
# This is not a problem: we will eventually be woken up (in
|
||||||
# result_queue.get()) and be able to send a sentinel again.
|
# result_queue.get()) and be able to send a sentinel again.
|
||||||
|
|
|
@ -109,6 +109,12 @@ class ExecutorShutdownTest(unittest.TestCase):
|
||||||
self.assertFalse(err)
|
self.assertFalse(err)
|
||||||
self.assertEqual(out.strip(), b"apple")
|
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):
|
class ThreadPoolShutdownTest(ThreadPoolMixin, ExecutorShutdownTest):
|
||||||
def _prime_executor(self):
|
def _prime_executor(self):
|
||||||
|
|
|
@ -422,6 +422,10 @@ Core and Builtins
|
||||||
Library
|
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
|
- Issue #13502: threading: Fix a race condition in Event.wait() that made it
|
||||||
return False when the event was set and cleared right after.
|
return False when the event was set and cleared right after.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue