mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
## Summary Fixes the remaining kqueue filter comparison bug in `packages/bun-usockets/src/eventing/epoll_kqueue.c` that caused excessive CPU usage with network requests on macOS: - **`us_loop_run_bun_tick` filter comparison (line 302-303):** kqueue filter values (`EVFILT_READ=-1`, `EVFILT_WRITE=-2`) were compared using bitwise AND (`&`) instead of equality (`==`). Since these are signed negative integers (not bitmasks), `(-2) & (-1)` = `-2` (truthy), meaning every `EVFILT_WRITE` event was also misidentified as `EVFILT_READ`. This was already fixed in `us_loop_run` (by PR #25475) but the same bug remained in `us_loop_run_bun_tick`, which is the primary event loop function used by Bun. This is a macOS-only issue (Linux uses epoll, which is unaffected). Closes #26811 ## Test plan - [x] Added regression test at `test/regression/issue/26811.test.ts` that makes concurrent HTTPS POST requests - [x] Test passes with `bun bd test test/regression/issue/26811.test.ts` - [ ] Manual verification on macOS: run the reporter's [repro script](https://gist.github.com/jkoppel/d26732574dfcdcc6bfc4958596054d2e) and confirm CPU usage stays low 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>