Skip to content

Upgrade vminitd API to use grpc-swift-2. (#578)#669

Open
jglogan wants to merge 1 commit intoapple:mainfrom
jglogan:grpc-swift-2
Open

Upgrade vminitd API to use grpc-swift-2. (#578)#669
jglogan wants to merge 1 commit intoapple:mainfrom
jglogan:grpc-swift-2

Conversation

@jglogan
Copy link
Copy Markdown
Contributor

@jglogan jglogan commented Apr 8, 2026

  • Closes Use grpc-swift v2 #51. Again.
  • No real notable API changes. The largest change code-wise is in Vminitd. The connection loop is set up immediately in the new API by calling runConnections() on the client, and this blocks until either the task it's running on is cancelled or beginGracefulShutdown is called. Because of this, either we'd have to modify our API to have VirtualMachineAgent implementations call some run() method, or we just put runConnections in an internal task on Vminitd. This change uses the latter approach as it's simpler.
  • Updated dependencies to pick up latest protobuf and grpc-swift-2 fixes.
  • ClientBootstrap.withConnectedSocket(fd).wait() registers the vsock fd with epoll/kqueue immediately. vminitd sends its HTTP/2 SETTINGS frame right away upon accepting the connection, so those bytes can arrive on the fd — and be read by NIO — before the gRPC pipeline is installed. With a bare pipeline, NIO has nowhere to send the bytes and discards them.
  • Buffer until ClientConnectionHandler is in the pipeline so it can process the SETTINGS frame and fire .ready, then schedule delivery of the buffered data with assumeIsolatedUnsafeUnchecked().execute.
  • To help produce more accurate merged logs, defines a StderrLogHandler in the vminitd Application.swift that writes timestamps to the boot log with millisecond precision and format identical to that of the log files created using the --log-root arg on container.
  • Updates hawkeye to latest version (v6.5.1).

- No real notable API changes. The largest change code-wise is in
Vminitd. The connection loop is set up immediately in the new API by
calling runConnections() on the client, and this blocks until either the
task it's running on is cancelled or beginGracefulShutdown is called.
Because of this, either we'd have to modify our API to have
VirtualMachineAgent implementations call some run() method, or we just
put runConnections in an internal task on Vminitd. This change uses the
latter approach as it's simpler.
- Updated dependencies to pick up latest protobuf and grpc-swift-2
fixes.
- ClientBootstrap.withConnectedSocket(fd).wait() registers the vsock fd
with epoll/kqueue immediately. vminitd sends its HTTP/2 SETTINGS frame
right away upon accepting the connection, so those bytes can arrive on
the fd — and be read by NIO — before the gRPC pipeline is installed.
With a bare pipeline, NIO has nowhere to send the bytes and discards
them.
- Buffer until ClientConnectionHandler is in the pipeline so it can
process the SETTINGS frame and fire .ready, then schedule delivery of
the buffered data with assumeIsolatedUnsafeUnchecked().execute.
- To help produce more accurate merged logs, defines a
`StderrLogHandler` in the vminitd Application.swift that writes
timestamps to the boot log with millisecond precision and format
identical to that of the log files created using the `--log-root` arg on
`container`.
- Updates hawkeye to latest version (v6.5.1).

---------

Co-authored-by: Danny Canter <danny_canter@apple.com>
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.

Use grpc-swift v2

1 participant