Repository navigation
fix(pool): detect dead pool threads in ProcessPool and ThreadPool - #172
Merged
Merged
Conversation
Owner
|
Thanks! |
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #170.
BasePool._update_pool_status marks the pool as ERROR when one of the threads in self._loops has died. But neither ProcessPool nor ThreadPool ever set
_loops, so it stayed as the empty tuple fromBasePool.__init__. A dead manager thread went unnoticed and active kept returning True.This sets
_loopsin _start_pool for both pools, so the status check can see their threads.I added a test to test_thread_pool.py and test_process_pool_fork.py. Each one swaps pool_manager_loop for a function that exits right away, waits for the thread to end, and checks that active is False. Both tests fail without the fix. The full test suite and pyright pass locally.
This doesn't cover the other part of #170, where futures that were pending when the thread died stay PENDING.