Repository navigation
🐛 fix(query): respect timeout with child pipes - #228
Merged
Merged
Conversation
gaborbernat
enabled auto-merge (squash)
November 3, 2026 02:13
A child can keep query pipes open after the candidate exits, leaving daemon readers blocked beyond the timeout. Poll POSIX pipes for readiness and cancel pending Windows reads before joining both readers.
Force one-byte pipe reads so the test exercises a decoder that yields no character until the remaining bytes arrive. Drop the explicit continue to keep Python 3.9 coverage at 100%.
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.
_collect_query_output()joined its reader threads after killing a timed-out interpreter candidate. A child that inherited the output pipes could keep discovery blocked until the child exited. The timeout path now reaps the candidate and stops both query readers before returning. Fixes #196.A child keeps the pipes open
A POSIX pipe reports EOF only after every write descriptor closes, and Windows anonymous pipe reads also wait for the write handles to close. The old unbounded joins could therefore wait for a descendant after the candidate exited. The new stop event and readiness wait let POSIX readers exit without pipe EOF. On Windows, the reader cleanup uses CancelSynchronousIo to interrupt a blocked read before joining the thread. The output cap remains 1,048,576 characters per stream.
Behavior changes
When a timed-out candidate leaves a child holding its pipes, discovery returns after the query timeout and its existing retry without leaving query reader threads blocked. The child itself is not terminated by this change.
Reported by Anthropic's OSS Scanner: ANT-2026-RASICDKU.