Repository navigation
diag_server: complete serve when cancelled - #5233
Open
Sunil Muthuswamy (sunilmut) wants to merge 3 commits into
Open
Sunil Muthuswamy (sunilmut) wants to merge 3 commits into
Sunil Muthuswamy (sunilmut) wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the diagnostics shutdown coordination change.
No open issues 🎉
What changed in this PR
Fixes OpenHCL diagnostics shutdown so DiagServer::serve completes when cancellation is signalled or its sender is dropped, rather than waiting indefinitely for supporting loops.
Changes:
- Races the control server against the supporting loops, dropping remaining loops on completion while preserving error propagation.
- Clarifies that shutdown does not drain detached requests.
- Adds regression tests for idle and connected shutdown, control-server cancellation, and data-listener errors.
| File | Description |
|---|---|
openhcl/diag_server/src/lib.rs |
Updates shutdown coordination and documentation; adds regression tests. |
openhcl/diag_server/Cargo.toml |
Adds temporary-directory and tracing test dependencies. |
Cargo.lock |
Records the diagnostics server’s new test dependencies. |
Review effort: Balanced
Race the control server against the joined request and data loops. Preserve supporting-loop join behavior and propagate errors. Match the diagnostics worker's immediate-stop policy without draining detached requests. Add tests for idle and connected shutdown and data-listener errors.
Cover control RPC parameters/results, capture/profiler socket transfer, real child standard IO and terminal IO, file/record streaming, handshake failure recovery, disconnected services and full Unix RPC dispatch. No inspect API use, new production changes or dependency changes. Append tests to the existing diagnostics cancellation branch, preserving its prior shutdown fix and regression tests without rewriting history. Complete Linux x64 all-features passing-test production-line coverage: Before: 16.74% (108/645), 4 passing tests. After: 90.23% (582/645), 21 passing tests, none ignored. Remaining gaps include inspect/update handlers, VSOCK binding, TDX-only setup and defensive IO failures. These are not claimed covered. Check, all-targets clippy, doc, nextest, complete fresh coverage and final byte-stable repository formatting passed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Echo 131073 bytes, including NUL and non-UTF8 values, through real child IO in both pipe-backed and raw-socket modes. Send stdin, receive both outputs and wait concurrently. Assert every byte, the post-EOF stderr marker and exit status while clients remain open. Inspired by Linux and FreeBSD pipe readers draining buffered data before EOF. Existing small text cases do not protect multi-buffer binary delivery and exit notification together. Linux x64 passing production coverage stays 90.23% (582/645). Passing tests: 21 -> 22; none ignored. Check, clippy, doc, nextest, complete fresh coverage and byte-stable final repository fmt passed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sunil Muthuswamy (sunilmut)
force-pushed
the
user/sunilmut/diag-server-cancel-repro
branch
from
November 26, 2026 22:10
3f57c93 to
7ee27a3
Compare
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.
DiagServer::serveis documented to serve requests untilcancelis dropped,but only the control server observed cancellation. It returned, while
try_join3kept awaiting the request and data loops, soservenevercompleted and its listeners stayed live.
This change races the control server against the joined request and data
loops, returns the control server's result when it completes, and drops the
supporting loops. Errors from those loops still propagate. This matches the
diagnostics worker's immediate-stop policy without draining detached
requests.
Test changes:
the fix).