]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-125451: Fix deadlock in ProcessPoolExecutor shutdown (#125492)
authorSam Gross <colesbury@gmail.com>
Wed, 16 Oct 2024 15:39:17 +0000 (11:39 -0400)
committerGitHub <noreply@github.com>
Wed, 16 Oct 2024 15:39:17 +0000 (11:39 -0400)
commit760872efecb95017db8e38a8eda614bf23d2a22c
treee6c2e1e9b9cf59074bdf95a1d04481d5faf3d109
parentd83fcf8371f2f33c7797bc8f5423a8bca8c46e5c
gh-125451: Fix deadlock in ProcessPoolExecutor shutdown (#125492)

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`.
Lib/concurrent/futures/process.py
Lib/test/test_concurrent_futures/test_shutdown.py
Misc/NEWS.d/next/Library/2024-10-14-17-29-34.gh-issue-125451.fmP3T9.rst [new file with mode: 0644]