diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-07-15 23:13:34 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-07-15 23:13:34 (GMT) |
commit | d06a065a441896477f8dc4f5543654f6ba20bb51 (patch) | |
tree | e5914db2b6a27f0ccb55b74ce7fe0862c8f67c68 /Lib/concurrent | |
parent | db535957cd4b44c6176e49dc2d28f034ece5262c (diff) | |
download | cpython-d06a065a441896477f8dc4f5543654f6ba20bb51.zip cpython-d06a065a441896477f8dc4f5543654f6ba20bb51.tar.gz cpython-d06a065a441896477f8dc4f5543654f6ba20bb51.tar.bz2 |
Fix potential resource leaks in concurrent.futures.ProcessPoolExecutor
by joining all queues and processes when shutdown() is called.
Diffstat (limited to 'Lib/concurrent')
-rw-r--r-- | Lib/concurrent/futures/process.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py index 41e1320..7c22a62 100644 --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -209,6 +209,8 @@ def _queue_management_worker(executor_reference, # some multiprocessing.Queue methods may deadlock on Mac OS X. for p in processes.values(): p.join() + # Release resources held by the queue + call_queue.close() while True: _add_call_item_to_queue(pending_work_items, @@ -246,7 +248,8 @@ def _queue_management_worker(executor_reference, # Clean shutdown of a worker using its PID # (avoids marking the executor broken) assert shutting_down() - del processes[result_item] + p = processes.pop(result_item) + p.join() if not processes: shutdown_worker() return |