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

[3.12] gh-132969: Fix exception/hang shutdown(wait=False) and a task exited abnormally by ogbiggles · Pull Request #133220 · python/cpython · GitHub

/ cpython Public

[3.12] gh-132969: Fix exception/hang shutdown(wait=False) and a task exited abnormally - #133220

Closed
ogbiggles wants to merge 2 commits into
python:3.12from
ogbiggles:3.12
Closed

[3.12] gh-132969: Fix exception/hang shutdown(wait=False) and a task exited abnormally#133220
ogbiggles wants to merge 2 commits into
python:3.12from
ogbiggles:3.12

Conversation

ogbiggles commented Apr 30, 2025
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

When shutdown is called with wait=False, the executor thread keeps running even after the ProcessPoolExecutor's state is reset. The executor then tries to replenish the worker processes pool resulting in an error and a potential hang when it comes across a worker that has died. Fixed the issue by having _adjust_process_count() return without doing anything if the ProcessPoolExecutor's state has been reset.

Added unit tests to validate two scenarios:
max_workers < num_tasks (exception)
max_workers > num_tasks (exception + hang)

…ted abnormally

When shutdown is called with wait=False, the executor thread keeps running
even after the ProcessPoolExecutor's state is reset. The executor then tries
to replenish the worker processes pool resulting in an error and a potential hang
when it comes across a worker that has died. Fixed the issue by having
_adjust_process_count() return without doing anything if the ProcessPoolExecutor's
state has been reset.

Added unit tests to validate two scenarios:
max_workers < num_tasks (exception)
max_workers > num_tasks (exception + hang)

bedevere-app Bot commented Apr 30, 2025

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

python-cla-bot Bot commented Apr 30, 2025
edited
Loading

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

ogbiggles changed the title gh-132969: Fix exception/hang shutdown(wait=False) and a task exited abnormally [3.12] gh-132969: Fix exception/hang shutdown(wait=False) and a task exited abnormally Apr 30, 2025

itamaro commented Apr 30, 2025

Copy link
Copy Markdown
Contributor

thank you for the contribution, @ogbiggles. unfortunately, Python 3.12 is no longer accepting bug fixes, only security fixes.
if this issue still exists on main branch and/or the 3.13 branch, you can open a new PR for main.
I'll close this PR for now, but if this is a security fix, please re-open!

itamaro closed this Apr 30, 2025

Copy link
Copy Markdown
Contributor Author

thank you for the contribution, @ogbiggles. unfortunately, Python 3.12 is no longer accepting bug fixes, only security fixes. if this issue still exists on main branch and/or the 3.13 branch, you can open a new PR for main. I'll close this PR for now, but if this is a security fix, please re-open!

Got it, thanks. Submitted a new PR #133222 for main branch.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL