You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ProcessPoolExecutor raises exception or hangs the process when shutdown(wait=False) and worker throws exception #132969
After deeping in code, it seems to me that the bug is the run method of _ExecutorManagerThread.
When shutdown with wait set to False is called, this method always tries to ajust the process count.
Shutdown wait=False resets the ProcessPoolExecutor's state, hence returning from _adjust_process_counts() when the state has been reset fixes both issues. I submitted a PR #133220 with that fix and a couple of unittests to validate the fix.
p.s. my PR is on the 3.12 branch, and this is my first time contributing to cpython, so am not sure what steps (if any) I need to follow for porting the fix to 3.13 and main.
p.s. my PR is on the 3.12 branch, and this is my first time contributing to cpython, so am not sure what steps (if any) I need to follow for porting the fix to 3.13 and main.
Resubmitted a new pull request on main since the 3.12 branch is closed for bug fixes.
Activity
YvesDup commentedon Apr 30, 2025
After deeping in code, it seems to me that the bug is the
runmethod of_ExecutorManagerThread.When
shutdownwithwaitset to False is called, this method always tries to ajust the process count.cpython/Lib/concurrent/futures/process.py
Lines 361 to 363 in 8b26b23
These lines should be replace as below:
This modification fixes the 2 cases
gh-132969 fix ProcessPoolExecutor exception and hang
ogbiggles commentedon Apr 30, 2025
Shutdown wait=False resets the ProcessPoolExecutor's state, hence returning from _adjust_process_counts() when the state has been reset fixes both issues. I submitted a PR #133220 with that fix and a couple of unittests to validate the fix.
p.s. my PR is on the 3.12 branch, and this is my first time contributing to cpython, so am not sure what steps (if any) I need to follow for porting the fix to 3.13 and main.
ogbiggles commentedon May 1, 2025
Resubmitted a new pull request on main since the 3.12 branch is closed for bug fixes.
hugovk commentedon May 5, 2025
Deferred re: #133222 (comment).
4 remaining items
pythongh-132969: Fix error/hang when shutdown(wait=False) and task ex…
pythongh-132969: Fix error/hang when shutdown(wait=False) and task ex…
[3.14] gh-132969: Fix error/hang when shutdown(wait=False) and task e…
[3.13] gh-132969: Fix error/hang when shutdown(wait=False) and task e…
encukou commentedon Jun 16, 2025
Backported. Thank you @ogbiggles & and all reviewers!
pythongh-132969: Fix error/hang when shutdown(wait=False) and task ex…
pythongh-132969: Fix error/hang when shutdown(wait=False) and task ex…
gh-132969: update ACKS file (gh-133222) (#136144)
pythongh-132969: update ACKS file (pythongh-133222) (python#136144)
pythongh-132969: Fix error/hang when shutdown(wait=False) and task ex…
pythongh-132969: update ACKS file (pythongh-133222) (python#136144)
pythongh-132969: Fix error/hang when shutdown(wait=False) and task ex…
pythongh-132969: update ACKS file (pythongh-133222) (python#136144)