Skip to content

sidecar_client: panic on unexpected completion read errors - #5241

Open
Sunil Muthuswamy (sunilmut) wants to merge 2 commits into
microsoft:mainfrom
sunilmut:user/sunilmut/sidecar-reader-error-repro
Open

Sunil Muthuswamy (sunilmut) wants to merge 2 commits into
microsoft:mainfrom
sunilmut:user/sunilmut/sidecar-reader-error-repro

Conversation

@sunilmut

Copy link
Copy Markdown
Member

The sidecar completion reader (sidecar_wait_loop) is the only source of VP
completions. On a read error other than "would block", it logged and exited,
leaving every running VP on that node waiting forever with no further
signal.

The current OHCL sidecar driver cannot return such an error: sidecar_read
fails only with -EINVAL (buffer under 4 bytes), -EFAULT, -EAGAIN, or an
interrupted wait in blocking mode, and the client always reads 4 bytes into a
valid buffer from a device opened O_NONBLOCK. This change treats an
unexpected read error as a broken invariant and panics, matching the loop's
existing panics on impossible conditions, so a future driver change surfaces
as a crash dump rather than a silent hang. The now-unreachable post-loop log
is removed. OpenHCL builds use panic = 'abort'.

Test changes (the crate's first unit test):

  • Runs the real sidecar_wait_loop with a VP waiting, against an eventfd
    holding a pending value (pollable; a 4-byte read fails with EINVAL), and
    requires a panic. Before the change the reader logged
    "sidecar wait failed: Invalid argument" and returned.

@sunilmut
Sunil Muthuswamy (sunilmut) requested a review from a team as a code owner November 23, 2026 00:45
Copilot AI balanced review requested due to automatic review settings November 23, 2026 00:45
@github-actions github-actions Bot added the unsafe Related to unsafe code label Nov 23, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the change that makes unexpected sidecar read errors fatal.

No open issues 🎉

What changed in this PR

This PR makes unexpected sidecar completion read errors fatal, preventing the reader from silently exiting and leaving running virtual processors waiting indefinitely.

Changes:

  • Panic on read errors other than “would block” and remove the post-loop error log.
  • Add a regression test using an eventfd to trigger a read error and verify the panic.
  • Add the Linux-only test tracing dependency.
File Description
openhcl/​sidecar_client/​src/​lib.rs Makes unexpected read errors fatal and adds a regression test.
openhcl/​sidecar_client/​Cargo.toml Adds test_with_tracing as a Linux-only development dependency.
Cargo.lock Records the new sidecar client test dependency.

Review effort: Balanced

The completion reader is the only source of VP completions. On a read
error other than "would block" it logged and exited, leaving every
running VP on that node waiting forever. The current sidecar driver
cannot return such an error, so treat one as a broken invariant and
panic, matching the reader's other checks, instead of hanging silently.

Test changes:
- Add the crate's first unit test.
- Verify a read error (eventfd rejecting a 4-byte read) panics the
  reader instead of leaving a running VP waiting.
@sunilmut
Sunil Muthuswamy (sunilmut) force-pushed the user/sunilmut/sidecar-reader-error-repro branch from 31713b5 to 9e2315b Compare November 26, 2026 22:03
Copilot AI balanced review requested due to automatic review settings November 26, 2026 22:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the change to fail fast on unexpected sidecar completion read errors.

No open issues 🎉

Review effort: Balanced

@sunilmut

Copy link
Copy Markdown
Member Author

Hi John Starks (@jstarks), thanks for your earlier approval. We have now rebased this PR onto main. Could you please take another look at the rebased changes when you have a chance? Thanks!

Copilot AI balanced review requested due to automatic review settings November 26, 2026 22:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the change that makes unexpected sidecar completion read errors fatal instead of silently leaving virtual processors waiting.

No open issues 🎉

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants