File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -213,9 +213,7 @@ def shutdown_one_process():
213213 work_item .future .set_exception (result_item .exception )
214214 else :
215215 work_item .future .set_result (result_item .result )
216- continue
217- # If we come here, we either got a timeout or were explicitly woken up.
218- # In either case, check whether we should start shutting down.
216+ # Check whether we should start shutting down.
219217 executor = executor_reference ()
220218 # No more work items can be added if:
221219 # - The interpreter is shutting down OR
@@ -234,9 +232,6 @@ def shutdown_one_process():
234232 p .join ()
235233 call_queue .close ()
236234 return
237- else :
238- # Start shutting down by telling a process it can exit.
239- shutdown_one_process ()
240235 del executor
241236
242237_system_limits_checked = False
Original file line number Diff line number Diff 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
113119class ThreadPoolShutdownTest (ThreadPoolMixin , ExecutorShutdownTest ):
114120 def _prime_executor (self ):
Original file line number Diff line number Diff line change @@ -97,6 +97,10 @@ Core and Builtins
9797Library
9898-------
9999
100+ - Issue #12364: Fix a hang in concurrent.futures.ProcessPoolExecutor.
101+ The hang would occur when retrieving the result of a scheduled future after
102+ the executor had been shut down.
103+
100104- Issue #13502: threading: Fix a race condition in Event.wait() that made it
101105 return False when the event was set and cleared right after.
102106
You can’t perform that action at this time.
0 commit comments