Skip to content

usockets (Windows): keep a closed socket allocated until the dispatch that closed it returns - #39910

Closed
dylan-conway wants to merge 6 commits into
mainfrom
claude/deinitialization-test-windows-ci-3bd875
Closed

usockets (Windows): keep a closed socket allocated until the dispatch that closed it returns#39910
dylan-conway wants to merge 6 commits into
mainfrom
claude/deinitialization-test-windows-ci-3bd875

Merge remote-tracking branch 'origin/main' into claude/deinitializati…

137e969
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Aug 22, 2026 in 21m 59s

Code review found 1 important issue

Found 2 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/eventing/libuv.c:164-177 uv_close deferred past bsd_close_socket: AFD cancel ioctl on closed/reused handle

Annotations

Check failure on line 177 in packages/bun-usockets/src/eventing/libuv.c

See this annotation in the file changed.

@claude claude / Claude Code Review

uv_close deferred past bsd_close_socket: AFD cancel ioctl on closed/reused handle

Deferring `uv_close` from `us_poll_stop` to `us_poll_free` reorders it to run *after* the caller's `bsd_close_socket` (socket.c:201-202/304-313, context.c:484-485, udp.c:118-119), so `uv__poll_close`'s AFD cancel ioctl now targets a closed socket handle. Under `ProcessStrictHandleCheckPolicy` (always on inside AppContainer) that terminates the process with `0xC0000008 STATUS_INVALID_HANDLE` — robobun's dual-build comparison reproduced this 3/3 on this build with the extended `appcontainer.test