]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-125451: Fix deadlock in ProcessPoolExecutor shutdown (GH-125492) (#125599)
authorSam Gross <colesbury@gmail.com>
Wed, 16 Oct 2024 18:03:32 +0000 (14:03 -0400)
committerGitHub <noreply@github.com>
Wed, 16 Oct 2024 18:03:32 +0000 (14:03 -0400)
commit4256847190e3f87ec357a1a4e8d9eb5c57367d5e
treeefbb7425c1004b6f484192f53c21173f98114b50
parentcbd50a4bdc7ec474221334324a09e5f2053adea6
[3.12] gh-125451: Fix deadlock in ProcessPoolExecutor shutdown (GH-125492) (#125599)

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)
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]