Skip to content

Wait on callback pipes with poll - #78

Merged
benoitc merged 1 commit into
mainfrom
fix-fd-setsize
Aug 29, 2026
Merged

Wait on callback pipes with poll#78
benoitc merged 1 commit into
mainfrom
fix-fd-setsize

Conversation

@benoitc

@benoitc benoitc commented Aug 29, 2026

Copy link
Copy Markdown
Owner

The macOS CI flake in py_reentrant_SUITE was not a flake: the thread-callback pipes waited with select(), 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 use poll(), 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.

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.
@benoitc
benoitc merged commit ca7f8a7 into main Aug 29, 2026
20 checks passed
@benoitc
benoitc deleted the fix-fd-setsize branch August 29, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant