Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b713adf

Browse filesBrowse files
authored
bpo-31326: ProcessPoolExecutor waits for the call queue thread (#3265)
* bpo-31326: ProcessPoolExecutor waits for the call queue thread concurrent.futures.ProcessPoolExecutor.shutdown() now explicitly closes the call queue. Moreover, shutdown(wait=True) now also join the call queue thread, to prevent leaking a dangling thread. * Fix for shutdown() being called twice.
1 parent 97e1b1c commit b713adf
Copy full SHA for b713adf

2 files changed

+8-1Lines changed: 8 additions & 1 deletion

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Lib/concurrent/futures/process.py‎

Copy file name to clipboardExpand all lines: Lib/concurrent/futures/process.py
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,11 @@ def shutdown(self, wait=True):
507507
# To reduce the risk of opening too many files, remove references to
508508
# objects that use file descriptors.
509509
self._queue_management_thread = None
510-
self._call_queue = None
510+
if self._call_queue is not None:
511+
self._call_queue.close()
512+
if wait:
513+
self._call_queue.join_thread()
514+
self._call_queue = None
511515
self._result_queue = None
512516
self._processes = None
513517
shutdown.__doc__ = _base.Executor.shutdown.__doc__
Collapse file
+3Lines changed: 3 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
concurrent.futures.ProcessPoolExecutor.shutdown() now explicitly closes the
2+
call queue. Moreover, shutdown(wait=True) now also join the call queue
3+
thread, to prevent leaking a dangling thread.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.