Skip to content

serve: trace handler callbacks from the wrapper instead of rooting them as Strong - #32215

Closed
alii wants to merge 48 commits into
mainfrom
ali/serve-handlers-gc-traced-v2
Closed

serve: trace handler callbacks from the wrapper instead of rooting them as Strong#32215
alii wants to merge 48 commits into
mainfrom
ali/serve-handlers-gc-traced-v2

[autofix.ci] apply automated fixes

35f9dc6
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 9, 2026 in 23m 13s

Code review found 1 potential issue

Found 3 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/runtime/server/ServerWebSocket.rs:1374-1383 close() double-decrements active_websocket_count when reason-arg toString() re-entrantly closes the socket

Annotations

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

See this annotation in the file changed.

@claude claude / Claude Code Review

close() double-decrements active_websocket_count when reason-arg toString() re-entrantly closes the socket

nit: the compensating `on_websocket_closed()` at lines 1381-1383 runs after `to_slice_or_null(args.ptr[1])` at line 1371, which invokes user `toString()` and can re-entrantly call `ws.close()`. The inner call sees `is_closed()==false` (the flag is only set at line 1377), runs its own compensation (count N→N-1), then the outer call resumes without re-checking `is_closed()` and decrements again (N-1→N-2). Re-check `if self.is_closed() { return Ok(UNDEFINED); }` immediately before line 1376, or hoi