Wait on callback pipes with poll - #78
Merged
Merged
Conversation
select() is undefined for a descriptor above FD_SETSIZE, so a VM with more than 1024 open files could not bring up a thread worker and every thread callback after that failed with "Failed to spawn thread handler". The ready-wait also releases the GIL, and the coordinator logs a failed ready signal instead of leaving Python to time out.
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.
The macOS CI flake in
py_reentrant_SUITEwas not a flake: the thread-callback pipes waited withselect(), which cannot watch a descriptor above 1024, and a test run that had just exercised the isolated suites had that many files open. The first worker created past that point timed out on its ready signal and, since it stayed in the pool, took every later thread callback down with it. The waits now usepoll(), the ready-wait no longer holds the GIL, and the coordinator reports a failed ready write with its reason. A new case forces descriptors above the limit and runs several thread callbacks at once; with the fix reverted it reproduces the CI failure exactly.