Release Bun.serve handler Strongs once the server is idle (native↔JS cycle leak) - #32086
Closed
alii wants to merge 14 commits into
Closed
Release Bun.serve handler Strongs once the server is idle (native↔JS cycle leak)#32086alii wants to merge 14 commits into
alii wants to merge 14 commits into
Claude / Claude Code Review
completed
Jun 11, 2026 in 23m 7s
Code review found 1 important issue
Found 5 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 1 |
| 🟡 Nit | 0 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🔴 Important | src/runtime/server/server_body.rs:2251-2256 |
reload() after graceful stop with live websockets unprotects the active handler |
Annotations
Check failure on line 2256 in src/runtime/server/server_body.rs
claude / Claude Code Review
reload() after graceful stop with live websockets unprotects the active handler
The comment here ("a stopped (idle) server can never invoke the handlers this reload just installed") is not true when `stop()` was graceful and websockets opened before the reload are still connected: the swap at line 2203 resets `active_connections` to 0 at the same address the live `ServerWebSocket` `BackRef`s point into, so `has_active_web_sockets()` reads the new zero counter and this `deinit_if_we_can()` unprotects the freshly installed handler while those sockets are still dispatching to
Loading