Skip to content

main/poll: Fix kqueue event buffer overflow in grouped mode#22606

Open
bukka wants to merge 1 commit into
php:masterfrom
bukka:poll_kqueue_event_top_up
Open

main/poll: Fix kqueue event buffer overflow in grouped mode#22606
bukka wants to merge 1 commit into
php:masterfrom
bukka:poll_kqueue_event_top_up

Conversation

@bukka

@bukka bukka commented Jul 5, 2026

Copy link
Copy Markdown
Member

Cap each kevent() request at the number of entries that can still be delivered instead of requesting twice the buffer size. Events that are not retrieved (including oneshot and edge-triggered ones) stay pending in the kqueue and are delivered by the next wait, matching the epoll behavior. Merged read+write events can under-fill the buffer, so top up with zero timeout rounds, and base the suitable max events on the filter count so a default sized wait retrieves everything in one call.

Cap each kevent() request at the number of entries that can still be
delivered instead of requesting twice the buffer size. Events that are
not retrieved (including oneshot and edge-triggered ones) stay pending
in the kqueue and are delivered by the next wait, matching the epoll
behavior. Merged read+write events can under-fill the buffer, so top up
with zero timeout rounds, and base the suitable max events on the
filter count so a default sized wait retrieves everything in one call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant