KEMBAR78
[3.13] gh-125451: Fix deadlock in ProcessPoolExecutor shutdown (GH-125492) by miss-islington · Pull Request #125598 · python/cpython · GitHub
Skip to content

Conversation

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Oct 16, 2024

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 760872e)

Co-authored-by: Sam Gross colesbury@gmail.com

…GH-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`.
(cherry picked from commit 760872e)

Co-authored-by: Sam Gross <colesbury@gmail.com>
@colesbury colesbury merged commit 4fc4067 into python:3.13 Oct 16, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants