Skip to content

usockets: stop deriving eof from kqueue EV_EOF - #32257

Open
Jarred-Sumner wants to merge 7 commits into
mainfrom
claude/kqueue-ev-eof-drain
Open

Jarred-Sumner wants to merge 7 commits into
mainfrom
claude/kqueue-ev-eof-drain

kqueue: gate sentinel-eof on POLL_TYPE_SOCKET_SHUT_DOWN

eb448fb
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jun 15, 2026 in 29m 6s

Code review found 1 important issue

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

Details

Severity Count
🔴 Important 1
🟡 Nit 0
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important packages/bun-usockets/src/socket.c:662-667 us_socket_pause SSL-aware shut-down check mismatches raw-poll-type dispatch gate

Annotations

Check failure on line 667 in packages/bun-usockets/src/socket.c

See this annotation in the file changed.

@claude claude / Claude Code Review

us_socket_pause SSL-aware shut-down check mismatches raw-poll-type dispatch gate

The arm-side and consume-side of the new `watched==0` sentinel use mismatched definitions of "shut down" for SSL sockets. `us_socket_pause()` tests the SSL-aware `us_socket_is_shut_down(s)` (true once `SSL_SENT_SHUTDOWN` is set, even though `us_internal_ssl_shutdown` does **not** call `raw_shutdown` when `SSL_shutdown()` returns ≥0, so the poll type stays `POLL_TYPE_SOCKET`), but the dispatch gate at epoll_kqueue.c:316-317 requires the raw `us_internal_poll_type(poll) == POLL_TYPE_SOCKET_SHUT_DO