Repository navigation
Conversation
tick(0) broke out of its loop before asking the completion port, so run(.no_wait) only ran timers and what was already queued. epoll and kqueue ask the kernel once, with a zero timeout. A host driving the loop from its own event loop never saw a completion. Assisted-by: Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On the IOCP backend
tick(0)breaks out of its loop before it callsGetQueuedCompletionStatusEx, sorun(.no_wait)only runs timers and what is already queued. A completion the kernel has finished stays on the port until a blocking tick takes it.epoll and kqueue ask the kernel once with a zero timeout. IOCP's own
if (wait == 0) break;after the dequeue shows that was the intent, but as written it can't be reached withwait == 0.We hit this running a loop from Node's libuv in quic-zig: each wakeup ran
run(.no_wait), which collected nothing, so the server never saw a connection.Fix
tick(0)now dequeues once with a zero timeout, then leaves through the existingif (wait == 0) break;. Ticks withwait > 0are unchanged.Test
"iocp: no_wait collects what the kernel has finished" posts a
recvfrom, sends a datagram and runsno_waituntil it arrives, which without the fix it never does.processtests can't run in that container, as it lacks their helper binary.zig build test, 59 passedzig build -Demit-example -Demit-bench, andzig buildfor every target in the CI matrixCI on
mainfails until #250 moves the workflow to Zig 0.17, so this PR's checks will fail the same way until then.🤖 Generated with Claude Code