Skip to content

fix(vsock-host): poison interrupted frame writes#12247

Merged
seven332 merged 6 commits into
mainfrom
fix/12205-vsock-frame-write-cancel
May 9, 2026
Merged

fix(vsock-host): poison interrupted frame writes#12247
seven332 merged 6 commits into
mainfrom
fix/12205-vsock-frame-write-cancel

Conversation

@seven332
Copy link
Copy Markdown
Contributor

@seven332 seven332 commented May 8, 2026

Summary

  • centralize host request-frame writes behind a guarded helper
  • poison and close the vsock connection if an active frame write fails or is cancelled
  • add regression coverage for active-write cancellation and pre-lock cancellation

Tests

  • cargo test --manifest-path crates/Cargo.toml -p vsock-host
  • cargo clippy --manifest-path crates/Cargo.toml -p vsock-host --all-targets -- -D warnings
  • pre-commit: cargo-fmt, cargo-doc, cargo-clippy

Fixes #12205

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 95.74468% with 8 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
crates/vsock-host/src/lib.rs 95.74% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

@seven332
Copy link
Copy Markdown
Contributor Author

seven332 commented May 9, 2026

Code Review: PR #12247

Summary

Reviewed the vsock-host cancellation fix and tests. No P0/P1 issues found. The guarded write helper preserves the queued-writer cancellation behavior while poisoning the connection on active frame-write cancellation or failure.

Key Findings

Critical Issues (P0)

None.

High Priority (P1)

None.

Testing Review

Coverage

  • fix: active request-frame write cancellation corrupting the shared connection -> covered by test_cancel_during_frame_write_closes_connection.
  • fix: cancellation while waiting for writer lock should not close the connection -> covered by test_cancel_while_waiting_for_writer_lock_does_not_close_connection.
  • fix: bounded exec active write cancellation must clean pending response and stream registrations -> covered by test_cancel_during_bounded_exec_frame_write_cleans_up_registrations.

Convention Compliance

No violations found. The Rust inline tests use real UnixStream pairs, avoid artificial sleeps/fake timers, and synchronize via Notify or explicit polling. The test-only setsockopt unsafe block is narrowly scoped and documents its safety condition.

Testing Verdict: Adequate

Bad Smell Analysis

No bad-smell blockers found. No new public API surface, no fallback/error swallowing pattern, no artificial production delay, and no resource ownership issue found. The raw fd remains borrowed; socket ownership stays with the split stream halves.

Recommendations

No code changes requested.

Verdict

LGTM


Full review details: codereviews/20260509/
Testing standards: docs/testing.md

@seven332 seven332 force-pushed the fix/12205-vsock-frame-write-cancel branch from 1b3e1b1 to 00925e4 Compare May 9, 2026 02:07
@seven332 seven332 enabled auto-merge May 9, 2026 02:08
@seven332 seven332 added this pull request to the merge queue May 9, 2026
Merged via the queue into main with commit 1860100 May 9, 2026
82 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in VM0 Kanban May 9, 2026
@github-actions github-actions Bot mentioned this pull request May 9, 2026
@github-actions github-actions Bot deleted the fix/12205-vsock-frame-write-cancel branch May 9, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug: prevent cancellable vsock frame writes from corrupting connections

1 participant