Skip to content

fix(vsock): retain owner through gRPC handoff - #81

Merged
stephenlclarke merged 1 commit into
mainfrom
fix/80-retain-vsock-owner-through-grpc
Sep 8, 2026
Merged

fix(vsock): retain owner through gRPC handoff#81
stephenlclarke merged 1 commit into
mainfrom
fix/80-retain-vsock-owner-through-grpc

Conversation

@stephenlclarke

Copy link
Copy Markdown
Owner

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

The 0.14.3 release gate produced two container-runtime-linux crashes in separate serial integration paths. Both trapped in SwiftNIO with EBADF while a gRPC flush callback called writev on a VSOCK descriptor.

The existing owner association kept VZVirtioSocketConnection alive only for the FileHandle lifetime. Vminitd handed the raw descriptor to NIO and released that handle, allowing the Virtualization owner to disappear while the gRPC channel was still active. This change retains the handoff handle for the complete Vminitd client lifetime.

Closes #80.

Related upstream evidence: apple#678
Related upstream PR: apple#911

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

swift test --filter VsockListenerTests

Result: 2 focused tests passed. The new regression was also run against the previous implementation and failed at the expected owner-lifetime assertion.

Keep the descriptor FileHandle alive for the Vminitd client lifetime so its associated Virtualization connection cannot be released while NIO still uses the descriptor.

Add a focused ownership regression that fails without the retained handle and passes with the corrected lifetime.

Fixes #80

Related: apple#678

Related: apple#911
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Retain VSOCK owner through gRPC descriptor use

1 participant