Skip to content

fix(sidecar): buffer loopback TLS writes while the handshake is pending#190

Merged
NathanFlurry merged 1 commit into
mainfrom
stack/fix-sidecar-buffer-loopback-tls-writes-while-the-handshake-is-pending-onqnolqm
Jul 2, 2026
Merged

fix(sidecar): buffer loopback TLS writes while the handshake is pending#190
NathanFlurry merged 1 commit into
mainfrom
stack/fix-sidecar-buffer-loopback-tls-writes-while-the-handshake-is-pending-onqnolqm

Conversation

@NathanFlurry

Copy link
Copy Markdown
Member

Guest https.get to an in-guest TLS server failed with ERR_AGENTOS_NODE_SYNC_RPC:
the client upgrade leaves the rustls handshake incomplete (looping would deadlock
the guest thread that must service the server-side upgrade), so the first write
hit WouldBlock from the loopback transport and surfaced as a fatal sync-RPC error.

  • Buffer plaintext writes on loopback TLS sockets while the handshake is pending
    (bounded 4 MiB, warn at 80%, typed error on overflow); the TLS reader thread
    drives the handshake with a short poll timeout, flushes the buffer on
    completion, enforces TLS_HANDSHAKE_TIMEOUT, and honors deferred shutdown.
  • Interrupt flags on the loopback transport let a direct write reclaim the
    stream mutex from the reader without waiting out its poll.
  • Bridge: https.createServer now actually upgrades accepted sockets to TLS
    (options were previously discarded); client secureConnect defers to a
    macrotask without double-starting the read pump; first-read wake scheduling
    no longer requires bench metrics to be enabled; localAddress/localPort flow
    through connect.
  • New net/tls_loopback_get bench op (guest+node lanes, explicit unsupported
    native/wasm reasons) and engine support for unsupported-lane rendering.
  • Regression tests: loopback https round-trip; pending-write buffer cap.

@NathanFlurry

NathanFlurry commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

Stack for rivet-dev/secure-exec

Get stack: forklift get 190
Push local edits: forklift submit
Merge when ready: forklift merge 190

@NathanFlurry NathanFlurry mentioned this pull request Jul 2, 2026
@railway-app
railway-app Bot temporarily deployed to secure-exec / secure-exec-pr-190 July 2, 2026 06:49 Destroyed
@railway-app

railway-app Bot commented Jul 2, 2026

Copy link
Copy Markdown

🚅 Environment secure-exec-pr-190 in rivet-frontend has no services deployed.


🚅 Deployed to the secure-exec-pr-190 environment in secure-exec

Service Status Web Updated (UTC)
secure-exec 😴 Sleeping (View Logs) Web Jul 2, 2026 at 7:43 am

Guest https.get to an in-guest TLS server failed with ERR_AGENTOS_NODE_SYNC_RPC:
the client upgrade leaves the rustls handshake incomplete (looping would deadlock
the guest thread that must service the server-side upgrade), so the first write
hit WouldBlock from the loopback transport and surfaced as a fatal sync-RPC error.

- Buffer plaintext writes on loopback TLS sockets while the handshake is pending
  (bounded 4 MiB, warn at 80%, typed error on overflow); the TLS reader thread
  drives the handshake with a short poll timeout, flushes the buffer on
  completion, enforces TLS_HANDSHAKE_TIMEOUT, and honors deferred shutdown.
- Interrupt flags on the loopback transport let a direct write reclaim the
  stream mutex from the reader without waiting out its poll.
- Bridge: https.createServer now actually upgrades accepted sockets to TLS
  (options were previously discarded); client secureConnect defers to a
  macrotask without double-starting the read pump; first-read wake scheduling
  no longer requires bench metrics to be enabled; localAddress/localPort flow
  through connect.
- New net/tls_loopback_get bench op (guest+node lanes, explicit unsupported
  native/wasm reasons) and engine support for unsupported-lane rendering.
- Regression tests: loopback https round-trip; pending-write buffer cap.
@NathanFlurry
NathanFlurry force-pushed the stack/fix-sidecar-buffer-loopback-tls-writes-while-the-handshake-is-pending-onqnolqm branch from 4c621f3 to 9002178 Compare July 2, 2026 07:36
@railway-app
railway-app Bot temporarily deployed to secure-exec / secure-exec-pr-190 July 2, 2026 07:36 Destroyed
@NathanFlurry
NathanFlurry merged commit 9002178 into main Jul 2, 2026
2 of 3 checks passed
@NathanFlurry
NathanFlurry deleted the stack/fix-sidecar-buffer-loopback-tls-writes-while-the-handshake-is-pending-onqnolqm branch July 2, 2026 08:48
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.

1 participant