FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.13] gh-115634: Fix ProcessPoolExecutor deadlock with max_tasks_per_child (GH-140900) by gpshead · Pull Request #152928 · python/cpython · GitHub

/ cpython Public

[3.13] gh-115634: Fix ProcessPoolExecutor deadlock with max_tasks_per_child (GH-140900) - #152928

Merged
gpshead merged 1 commit into
python:3.13from
gpshead:backport-b706767-3.13
Jul 3, 2026
Merged

[3.13] gh-115634: Fix ProcessPoolExecutor deadlock with max_tasks_per_child (GH-140900)#152928
gpshead merged 1 commit into
python:3.13from
gpshead:backport-b706767-3.13

Conversation

gpshead commented Jul 3, 2026
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

The idle worker semaphore counts task completions, not idle workers, so it can hold a stale token released by a worker that later exited upon reaching its max_tasks_per_child limit. The worker replacement path consumed such tokens and skipped spawning a replacement, deadlocking the remaining queued tasks once no workers were left.

Replace dead workers based on len(self._processes) without consulting the semaphore. The submit() path is unchanged, preserving on-demand spawning and idle worker reuse.

Replace the documentation note added in GH-140897 with a versionchanged entry now that the bug is fixed.

Based on a fix proposed by Tabrez Mohammed.

(cherry picked from commit b706767)

…ks_per_child (pythonGH-140900)

The idle worker semaphore counts task completions, not idle workers, so
it can hold a stale token released by a worker that later exited upon
reaching its max_tasks_per_child limit. The worker replacement path
consumed such tokens and skipped spawning a replacement, deadlocking
the remaining queued tasks once no workers were left.

Replace dead workers based on len(self._processes) without consulting
the semaphore. The submit() path is unchanged, preserving on-demand
spawning and idle worker reuse.

Replace the documentation note added in pythonGH-140897 with a versionchanged
entry now that the bug is fixed.

Based on a fix proposed by Tabrez Mohammed.

(cherry picked from commit b706767)
gpshead merged commit 618ce0a into python:3.13 Jul 3, 2026
42 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

1 participant


Back | FazBrowse Home | New Git URL