Repository navigation
test(libkernel): wait for the loopback datagram in the reused-descriptor select check - #22313
Merged
oneandonlydean merged 1 commit intoNov 17, 2026
Conversation
PrivacyOnion
approved these changes
Nov 17, 2026
PrivacyOnion
left a comment
Contributor
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 57358252f1:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_select_testsbuilt cleanly. - CTest (
guest_select):1/1 Test #5495: guest_select ..................... Passed 4.74 sec 100% tests passed, 0 tests failed out of 1 - Code reading:
- Verified core/libs/tests/GuestSelect.cpp:187-188 timeout parameter change from {0, 0} to {1, 0} (1 second) for select_nid_postfix.
- Verified that guest select timeout semantics correctly accommodate asynchronous loopback packet queuing on Darwin / BSD platforms without weakening the test assertion.
- Verified GuestDescriptorSet initialization, bounds checking (reused + 1), and return code assertions (1 readable descriptor).
- Verified that descriptor lifecycle (send, select, recv, close) remains fully balanced and cleans up descriptors 'reused' and 'held' cleanly.
- Verified compliance with AGENTS.md conventions: no comments added, conventional commit format adhered to, no extraneous files or undocumented debt.
Looks Good To Me
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.
What
guest_selectfails on macOS since #21905 addedReusedDescriptorNumberIsSelectedFresh. The check sends a datagram on a UDP socket connected to itself, then callsselectwith a zero timeout and requires the socket to be readable at once. On macOS a loopback datagram is queued asynchronously. A host program that sends to itself on 127.0.0.1 and then callsselectwith a zero timeout sees it readable in 1 of 200 rounds, so the check fails on most runs.The check now waits up to one second for the datagram. It still checks what #21905 pins: the reused descriptor number must be looked up fresh. A stale entry for the closed socket would not become readable or would fail. On FreeBSD and Linux the datagram is already queued, so
selectreturns at once as before.The
pollcounterpart,ReusedDescriptorNumberIsPolledFresh, is left as it is. With #20161 merged,guest_pollpasses 10/10 on this Mac with the zero timeout.Tested
Apple M4, macOS 27.0.1, Apple clang 21.0.0, x86-64 Release build under Rosetta 2. Base:
maine798a424c7with #17425 and #11049 (needed for the macOS build).guest_selectfailedctest -R 'guest_poll|guest_select|guest_kqueue|socket|udp|tcp' -E '^agc_'(52 tests), twice with fix(libkernel): report a reset stream socket polled for no event as hung up on macOS #20161 and this PR:guest_selectpasses.guest_socket_optionsandguest_socket_port_zerofail as on the base; fix(libkernel): refuse a reconnect after a dropped connection on macOS #17879 and fix(libkernel): send to INADDR_ANY through 127.0.0.1 on macOS #17878 fix those.guest_socket_read_writefailed in one of the two runs; it also fails 3/10 on the base alone, so it is unrelated.python3 tools/check_conventions.py --base origin/mainandpython3 tools/debt_fold.py --checkpass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)