Skip to content

worker: guard the remaining NewSocket / ServerWebSocket / Bun.serve / Bun.$ dispatch sites against a pending termination - #36808

Open
robobun wants to merge 9 commits into
mainfrom
farm/a8e86549/worker-terminate-guards-round-2
Open

worker: guard the remaining NewSocket / ServerWebSocket / Bun.serve / Bun.$ dispatch sites against a pending termination#36808
robobun wants to merge 9 commits into
mainfrom
farm/a8e86549/worker-terminate-guards-round-2

server/shell: guard the ServerWebSocket / Bun.serve / Bun.$ dispatch …

f50ca6a
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Aug 3, 2026 in 29m 35s

Code review found 1 important issue

Found 4 candidates, confirmed 2. See review comments for details.

Details

Severity Count
🔴 Important 1
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/runtime/socket/socket_body.rs:109-116 Remaining socket-module JS-dispatch sites still gate on is_shutting_down()
🟡 Nit src/runtime/server/ServerWebSocket.rs:504-509 on_message/on_ping/on_pong early-return leaves the payload-conversion exception pending

Annotations

Check failure on line 116 in src/runtime/socket/socket_body.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

Remaining socket-module JS-dispatch sites still gate on is_shutting_down()

The ALPN gate is upgraded here, but its direct siblings in `src/runtime/socket/` still gate JS entry on `is_shutting_down()`: the two SNI `server_name` callbacks (`Listener.rs:1918` / `Listener.rs:2011`), `UpgradedDuplex::call_write_or_end` (`UpgradedDuplex.rs:210`), and `Handlers::{resolve_promise, reject_promise, call_error_handler}` (`Handlers.rs:218/234/280`). SNI in particular is the same BoringSSL-handshake shape as ALPN — multiple TLS handshakes in one poll sweep can fire back-to-back `se

Check warning on line 509 in src/runtime/server/ServerWebSocket.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

on_message/on_ping/on_pong early-return leaves the payload-conversion exception pending

nit: the `let Ok(payload) = ... else { return }` here (and in `on_ping`/`on_pong`) drops the `JsError` token without `take_exception()` + `run_error_callback`, whereas the sibling `on_close` in this file routes the identical `create_utf8_for_js` failure through the WS `error()` handler. Not blocking — the `_loop_guard` drop reports it as an uncaught exception so nothing is left pending — but matching `on_close`'s pattern would keep the error-path sequence consistent with the sibling exit site (a