Skip to content

🐛 fix(query): respect timeout with child pipes - #228

Merged
gaborbernat merged 3 commits into
tox-dev:mainfrom
gaborbernat:bug/rasicdku-probe-timeout
Nov 3, 2026
Merged

gaborbernat merged 3 commits into
tox-dev:mainfrom
gaborbernat:bug/rasicdku-probe-timeout

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

_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.

@gaborbernat gaborbernat added the bug Something isn't working label Nov 3, 2026
@gaborbernat
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%.
@gaborbernat
gaborbernat merged commit d480cd6 into tox-dev:main Nov 3, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A child holding probe pipes can outlast the query timeout

1 participant