[3.13] gh-132969: Fix error/hang when shutdown(wait=False) and task exited abnormally (GH-133222) (GH-135343)
gh-132969: Fix error/hang when shutdown(wait=False) and task exited abnormally (GH-133222) 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) (cherry picked from commit 598aa7cc98bc1b39f10ec41decddd8dd88799fe1) Co-authored-by: Ajay Kamdar <140011370+ogbiggles@users.noreply.github.com>
M
Miss Islington (bot) committed
404e8aa9f370491ef5918d618f8f9a7529183981
Parent: 3bd2818
Committed by GitHub <noreply@github.com>
on 6/16/2025, 12:08:03 PM