File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -209,6 +209,8 @@ def shutdown_worker():
209209 # some multiprocessing.Queue methods may deadlock on Mac OS X.
210210 for p in processes .values ():
211211 p .join ()
212+ # Release resources held by the queue
213+ call_queue .close ()
212214
213215 while True :
214216 _add_call_item_to_queue (pending_work_items ,
@@ -246,7 +248,8 @@ def shutdown_worker():
246248 # Clean shutdown of a worker using its PID
247249 # (avoids marking the executor broken)
248250 assert shutting_down ()
249- del processes [result_item ]
251+ p = processes .pop (result_item )
252+ p .join ()
250253 if not processes :
251254 shutdown_worker ()
252255 return
Original file line number Diff line number Diff line change @@ -634,7 +634,8 @@ def test_main():
634634 ThreadPoolAsCompletedTests ,
635635 FutureTests ,
636636 ProcessPoolShutdownTest ,
637- ThreadPoolShutdownTest )
637+ ThreadPoolShutdownTest ,
638+ )
638639 finally :
639640 test .support .reap_children ()
640641
Original file line number Diff line number Diff line change @@ -228,6 +228,9 @@ Core and Builtins
228228Library
229229-------
230230
231+ - Fix potential resource leaks in concurrent.futures.ProcessPoolExecutor
232+ by joining all queues and processes when shutdown() is called.
233+
231234- Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by
232235 Andreas Stührk.
233236
You can’t perform that action at this time.
0 commit comments