mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
[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 6782fc0502
)
Co-authored-by: Louis Paulot <55740424+lpaulot@users.noreply.github.com>
This commit is contained in:
parent
68ca19061d
commit
90ea3be6fb
3 changed files with 23 additions and 0 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue