Repository navigation
Give PollRegistrations' checks ten seconds for loopback to deliver (#431) - #444
Merged
Merged
Conversation
PollRegistrations failed now and then on macOS arm64 runners, a socket that had been sent bytes not reported readable within the second each check waited (libhxcpp #431). A traced loop of 400 runs on a runner failed 3 times this way and once with datagrams, and showed the kqueue backend was right: for the whole wait the client's FIONREAD was 0 and the server's write filter reported the 5 bytes still in its send buffer, so loopback had not delivered them. They arrived later, as the blocking read after the checks got them. A check now polls until its result matches or ten seconds pass, so it stops as soon as it matches and only a failing check waits the whole time. The library is unchanged.
28 of 34 tasks
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.
PollRegistrationsfailed now and then on macOS arm64 (#431): a socket that had been sent bytes wasn't reported readable within the one second each check waited. It turns out the kqueue backend was right, and loopback hadn't delivered the bytes yet.I ran the test 400 times on a macOS arm64 runner, with every kevent change and result traced and
FIONREADread for each socket after every wait. It failed 3 times the way #431 describes, and in another run once on the UDP check "ready in prepared order". In the failing TCP runs:FIONREADwas 0, and kqueue reported it writable only.So the delay is in delivery over loopback on the runner, not in Poll. The UDP failure fits too: the datagrams were reported on the next check.
A check now polls until its result matches or ten seconds pass, and so does the
Poll.pollcheck. A check that matches stops at once, as before, so only a failing one waits the whole time. The library is unchanged, so there's no Changes.md line.With this change I ran the loop twice more, 400 runs each, logging any check that took over half a second. None did, and all 800 runs passed, so those runners never stalled and the loops don't exercise the longer wait. The earlier failures came in 4 of 634 runs, on other runner machines. The traced runs: 43373583292 (3 failures) and 43373029128 (1). With the fix: 43376217521, both attempts.
Fixes #431.