summaryrefslogtreecommitdiffstats
path: root/Lib/concurrent/futures
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-07-10 22:49:07 (GMT)
committerGitHub <noreply@github.com>2023-07-10 22:49:07 (GMT)
commit90ea3be6fbee1520dd3e9344c71123e15fcbe6f2 (patch)
tree4488a0a59746eb75c8c010359394e54dccec5073 /Lib/concurrent/futures
parent68ca19061d19345a72574a6c3849981213de212b (diff)
downloadcpython-90ea3be6fbee1520dd3e9344c71123e15fcbe6f2.zip
cpython-90ea3be6fbee1520dd3e9344c71123e15fcbe6f2.tar.gz
cpython-90ea3be6fbee1520dd3e9344c71123e15fcbe6f2.tar.bz2
[3.12] gh-94777: Fix deadlock in ProcessPoolExecutor (GH-94784) (#106609)
gh-94777: Fix deadlock in ProcessPoolExecutor (GH-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. (cherry picked from commit 6782fc050281205734700a1c3e13b123961ed15b) Co-authored-by: Louis Paulot <55740424+lpaulot@users.noreply.github.com>
Diffstat (limited to 'Lib/concurrent/futures')
-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()