Skip to content

fix(net): fix-forward for #12267 — socket generations through HTTP rooting, restored witnesses, stale completions refused - #12282

Merged
proggeramlug merged 4 commits into
mainfrom
fix/12267-netfix
Oct 9, 2026
Merged

proggeramlug merged 4 commits into
mainfrom
fix/12267-netfix

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Fix-forward for #12267, which routes net and HTTP through native Socket payloads.

Commits:

  • Carry Socket generations through HTTP rooting and native writes. This is the narrow perf slice the design review cleared: snapshot carry, current_request_socket, removal of the ResponseConnection stack field, rooted constructor outlining, and NativeIo writes only when no TLS JS drive is proven.
  • Restore the Socket payload regression witnesses and node gap coverage. It restores the behaviour of the deleted tests on the new design:
    • an unopened socket refuses bytes;
    • queued callbacks get exactly one error and then close;
    • closed-socket errors keep node's code and message;
    • stored endpoints reach dynamic dispatch;
    • deferred connect;
    • a ws Client handle passed through helpers;
    • write() returning false, then drain;
    • a TLS wrapper data round trip;
    • a Worker with live sockets.
  • Document payload borrows; refuse stale net completions. // SAFETY: comments on the internal unsafe blocks. Abort-on-race unwrap() calls become generation-checked refusals.
  • Fix two gap witnesses: a case-insensitive ws key header, and an explicit Worker end.

Tests:

  • ext-net 29/0, ext-http 212/0, runtime net_transport and turnloop_net 35/0.
  • runtime gc:: 1752 pass. One test aborts identically on main and is filed separately.
  • All 11 negative controls are caught.
  • Gap subset (126 files, net/http/ws/upgrade/fetch/tls): main 108 pass, this PR 109. 0 regressions; tls_wrapper_roundtrip now passes.

A/B against main (n=5, instructions):

  • HTTP 10k +0.016%, net echo +0.044%, fastify +0.005%, tsc +0.006%, Zod −0.03%, hello +0.008%.
  • Full, budgeted and minor GC counts are identical.
  • RSS: anonymous memory is flat. The file-backed text deltas disappear when the binaries are copied to fresh files, so they are page-cache state, not code.

Not in this PR: recovering #12267's own +4.9% HTTP instructions. That needs the client-restart batching slice, which the design review did not clear, because the deadline/ref authority on wrapper and parent must be settled first. Follow-up issue to be filed.

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of network and HTTP socket operations when connections are closed, replaced, or unavailable, avoiding crashes in affected cases.
    • Prevented stale requests from using a reopened socket’s replacement connection.
    • Improved handling of TLS writes, connection setup, and worker shutdown.
  • Tests
    • Added coverage for socket writes, TLS round trips, backpressure, WebSocket dispatch, and live network activity in workers.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c69f258f-9981-4ff1-a898-aa7375108ffb

📥 Commits

Reviewing files that changed from the base of the PR and between f8e6d5a and 00c53a9.


📒 Files selected for processing (20)
  • changelog.d/12267-netfix.md
  • crates/perry-ext-http/src/client_turnloop/native_client.rs
  • crates/perry-ext-http/src/client_turnloop/native_client_tests.rs
  • crates/perry-ext-http/src/client_turnloop/protocol.rs
  • crates/perry-ext-http/src/lib.rs
  • crates/perry-ext-http/src/server/turnloop_route.rs
  • crates/perry-ext-http/src/server/turnloop_serve/conn.rs
  • crates/perry-ext-net/src/lib.rs
  • crates/perry-ext-net/src/native_transport.rs
  • crates/perry-ext-net/src/payload_io.rs
  • crates/perry-ext-net/src/payload_regression_tests.rs
  • crates/perry-ext-net/src/payload_server.rs
  • crates/perry-ext-net/src/payload_socket.rs
  • crates/perry-ext-net/src/payload_tls.rs
  • crates/perry-runtime/src/closure/dispatch/bound.rs
  • test-files/_helpers/net_payload_live_worker.ts
  • test-files/test_gap_net_payload_stored_endpoints.ts
  • test-files/test_gap_net_payload_tls_wrapper_roundtrip.ts
  • test-files/test_gap_net_payload_worker_live_sockets.ts
  • test-files/test_gap_ws_client_handle_cross_function_dispatch.ts

 ________________________________________
< C*deR*bb*t: The uncensored bug hunter. >
 ----------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug
proggeramlug merged commit c8da2ae into main Oct 9, 2026
92 of 101 checks passed
@proggeramlug
proggeramlug deleted the fix/12267-netfix branch October 9, 2026 22:58
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