summaryrefslogtreecommitdiffstats
path: root/Lib/concurrent
diff options
context:
space:
mode:
authorLouis Paulot <55740424+lpaulot@users.noreply.github.com>2023-07-10 21:45:27 (GMT)
committerGitHub <noreply@github.com>2023-07-10 21:45:27 (GMT)
commit6782fc050281205734700a1c3e13b123961ed15b (patch)
treec1e4b8d2154fddecfe095736202a04f96995c9aa /Lib/concurrent
parent9d582250d8fde240b8e7299b74ba888c574f74a3 (diff)
downloadcpython-6782fc050281205734700a1c3e13b123961ed15b.zip
cpython-6782fc050281205734700a1c3e13b123961ed15b.tar.gz
cpython-6782fc050281205734700a1c3e13b123961ed15b.tar.bz2
gh-94777: Fix deadlock in ProcessPoolExecutor (#94784)
Fixes a hang in multiprocessing process pool executor when a child process crashes and code could otherwise block on writing to the pipe. See GH-94777 for more details.
Diffstat (limited to 'Lib/concurrent')
-rw-r--r--Lib/concurrent/futures/process.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py
index 816edab..301207f 100644
--- a/Lib/concurrent/futures/process.py
+++ b/Lib/concurrent/futures/process.py
@@ -499,6 +499,10 @@ class _ExecutorManagerThread(threading.Thread):
for p in self.processes.values():
p.terminate()
+ # Prevent queue writing to a pipe which is no longer read.
+ # https://github.com/python/cpython/issues/94777
+ self.call_queue._reader.close()
+
# clean up resources
self.join_executor_internals()