Skip to content

usockets: re-arm readable in raw_shutdown after read_eof so the close is delivered on Windows - #34487

Open
robobun wants to merge 4 commits into
mainfrom
farm/26049e5b/usockets-half-open-disconnect-spin
Open

usockets: re-arm readable in raw_shutdown after read_eof so the close is delivered on Windows#34487
robobun wants to merge 4 commits into
mainfrom
farm/26049e5b/usockets-half-open-disconnect-spin

ci: retrigger

7c822d2
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Aug 12, 2026 in 31m 43s

Code review found 3 potential issues

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

Details

Severity Count
🔴 Important 0
🟡 Nit 3
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit packages/bun-usockets/src/socket.c:729-731 kqueue: read_eof arm in raw_shutdown makes the sentinel unreachable; a later resume() can then delete the read filter an

Annotations

Check warning on line 731 in packages/bun-usockets/src/socket.c

See this annotation in the file changed.

@claude claude / Claude Code Review

kqueue: read_eof arm in raw_shutdown makes the sentinel unreachable; a later resume() can then delete the read filter and strand the socket

On kqueue, the `read_eof` arm now leaves `us_poll_events == READABLE`, so the sentinel branch at line 734 (`!(events & READABLE)`) is unreachable in exactly the case this PR targets — the PR body's "kqueue is covered by the read sentinel" only holds while nothing later calls `us_poll_change(0)`. `us_socket_resume` on a paused, `read_eof`, shut-down socket does exactly that (its `is_shut_down` branch passes `readable = 0`), which pre-PR was an old==new no-op but post-PR goes R→0: kqueue EV_DELETE