testing: Close POSIX result pipes on FIFO EOF - #26082
Draft
eleanorjboyd wants to merge 2 commits into
Draft
Conversation
Drain nonblocking FIFO readers to EOF and explicitly dispose result pipes after the fallback timeout. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the disposable result pipe handle returned by the updated test utility. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a POSIX FIFO EOF detection gap in the test result named-pipe reader that caused test runs to regularly wait for the 5s RESULT_PIPE_DRAIN_TIMEOUT_MS fallback after the Python subprocess exited. It replaces the FIFO net.Socket reader with a direct FD reader that can reliably settle onClose on writer disconnect, and updates adapters to explicitly dispose result-pipe resources after the drain/timeout window.
Changes:
- Replace the POSIX FIFO reader implementation to detect writer EOF and fire close reliably (
FifoMessageReader). - Change
startRunResultNamedPipe()to return an owned{ name, dispose }handle and have pytest/unittest execution adapters dispose it after drain/timeout. - Update/extend unit tests to cover POSIX FIFO reader behavior and adapter disposal during cancellation.
Show a summary per file
| File | Description |
|---|---|
| src/client/common/pipes/namedPipes.ts | Adds a POSIX FIFO FD-based message reader and wires it into createReaderPipe(). |
| src/client/testing/testController/common/utils.ts | Changes startRunResultNamedPipe() to return an owned handle with a dispose() method. |
| src/client/testing/testController/pytest/pytestExecutionAdapter.ts | Uses resultPipe.name and disposes the result pipe after drain/timeout. |
| src/client/testing/testController/unittest/testExecutionAdapter.ts | Uses resultPipe.name and disposes the result pipe after drain/timeout. |
| src/test/common/pipes/namedPipes.unit.test.ts | Adds POSIX FIFO tests for buffered payloads, empty writer, and cancellation close. |
| src/test/testing/testController/pytest/pytestExecutionAdapter.unit.test.ts | Updates stubs to match the new { name, dispose } result-pipe return type. |
| src/test/testing/testController/unittest/testExecutionAdapter.unit.test.ts | Updates stubs to match the new { name, dispose } result-pipe return type. |
| src/test/testing/testController/testCancellationRunAdapters.unit.test.ts | Asserts the adapter disposes the result-pipe handle during cancellation flows. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Lite
Comment on lines
+197
to
+201
| if (bytesRead > 0) { | ||
| this.hasReadData = true; | ||
| this.stream.write(Buffer.from(this.buffer.subarray(0, bytesRead))); | ||
| continue; | ||
| } |
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.
Summary
net.Socketreader with a nonblocking reader that explicitly detects writer disconnect and emits reader completionWhy
A
net.Socketcreated from a nonblocking FIFO descriptor receives data but does not emitendorclosewhen the FIFO writer exits. After the cancellation drainage change, test execution therefore waited for the five-second fallback on every affected run.The new reader drains the descriptor directly and settles
onCloseafter EOF, avoiding the delay without reintroducing dropped buffered results.Fixes #26071