]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-125451: Fix deadlock in ProcessPoolExecutor shutdown (GH-125492) (GH-125598)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 16 Oct 2024 18:03:17 +0000 (20:03 +0200)
committerGitHub <noreply@github.com>
Wed, 16 Oct 2024 18:03:17 +0000 (14:03 -0400)
commit4fc4067796d223ed63240a2db425855ddbc3dd24
tree67daa111dcd51a36d55dcd347489d60559550d42
parent3fda8a824678ea5409509a22c09ab435acccd8c3
[3.13] gh-125451: Fix deadlock in ProcessPoolExecutor shutdown (GH-125492) (GH-125598)

There was a deadlock when `ProcessPoolExecutor` shuts down at the same
time that a queueing thread handles an error processing a task.

Don't use `_shutdown_lock` to protect the `_ThreadWakeup` pipes -- use
an internal lock instead. This fixes the ordering deadlock where the
`ExecutorManagerThread` holds the `_shutdown_lock` and joins the
queueing thread, while the queueing thread is attempting to acquire the
`_shutdown_lock` while closing the `_ThreadWakeup`.
(cherry picked from commit 760872efecb95017db8e38a8eda614bf23d2a22c)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Lib/concurrent/futures/process.py
Misc/NEWS.d/next/Library/2024-10-14-17-29-34.gh-issue-125451.fmP3T9.rst [new file with mode: 0644]