Repository navigation
fix(libkernel): report a stream whose peer closed as readable in poll on Windows - #8483
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Thanks, this matches |
66e92b2 to
ab21d78
Compare
|
Fixed in ab21d78: the socketpair entry in docs/dev/debt/libkernel.md now says that a pair end reports POLLIN after the peer's shutdown(SHUT_WR) or close on Windows; the remaining gap is that after close the console also reports POLLHUP (unp_drop disconnects the other end), which the loopback connection cannot tell from a shutdown, so no POLLHUP is reported. Docs only; no code change. AI-assisted (Claude Code). |
|
Linux follow-up validation of exact PR head Environment: Debian 13.7 x86-64, Linux
Command: ctest --test-dir build \
-R '^(guest_poll|guest_sce_net|guest_socket_error|guest_udp|guest_select|guest_select_wait|guest_tcp|guest_socket_pair|guest_recvmsg_memory|guest_socket_descriptors|guest_socket_options)$' \
--repeat until-fail:3 -VThe production fix is Windows-only, so this adds Linux coverage for the shared regression and surrounding socket behavior. No new Windows run, macOS, PS5 hardware, title, GPU, or full repository test-suite validation was performed. AI-assisted testing and report. |
… on Windows WSAPoll reports POLLHUP alone for a stream socket whose peer has closed, so poll never returned POLLIN for it and a caller waiting for POLLIN did not see the end of the stream. sopoll_generic reports a socket that can receive no more as readable and adds POLLHUP only once it can send no more either. poll now adds the requested read bit and keeps POLLHUP only after the socket shut its own sending side. A reset or refused connection keeps WSAPoll's flags. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eer closes On Windows a pair end now reports POLLIN after the peer's shutdown or close. The console also reports POLLHUP after close; the loopback connection cannot tell a close from a shutdown. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ab21d78 to
9abca4b
Compare
|
Re-checked against current |
…table in poll on macOS boykopovar#8483 corrects Windows poll for a stream socket whose peer shut its write side: readable, POLLRDNORM when asked, and no POLLHUP while this side can still send. XNU reports the same POLLHUP and, when POLLIN and POLLOUT are both requested, also drops POLLOUT, so guest_poll's new PollsAStreamWhosePeerClosed failed on macOS. On macOS the same ClosedStreamEvents correction now runs, and while this side has not shut its write side it re-checks POLLOUT with a zero-timeout poll and adds it back. Linux and Windows unchanged.
What
WSAPollreportsPOLLHUPalone for a stream socket whose peer has closed, whether or not the socket's own sending side is shut.pollpassed that on, so on Windows such a socket never came back asPOLLIN. FreeBSD'ssopoll_genericreports a socket that can receive no more as readable and addsPOLLHUPonly once it can send no more either (Linux'spollalready does this). On Windows, a guest stream socket'sPOLLHUPwithoutPOLLERRnow also reports the read bit that was asked for, and keepsPOLLHUPonly aftershutdownhas shut the socket's own sending side (Socket::sendShut). A reset or refused connection (POLLHUPwithPOLLERR) and libSceNet sockets keepWSAPoll's flags. A new Technical debt entry says so.Fixes #8482
Overlap:
git merge-treeagainst the open socket PRs #7090, #8392, #8448, #8463, #8474, #7511, #7850, #7490 and #8312 is clean.pr_overlapwas not run.Tested
Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release, on upstream/main 3cde166 + this commit:
guest_poll: the new case aborts without the change toUdp.cppand passes with it. It checksPOLLIN,POLLIN|POLLOUT,POLLRDNORMandPOLLOUTalone after the peer'sshutdown(SHUT_WR)(noPOLLHUP),recvreturning 0, andPOLLIN|POLLHUPon both ends once the other side has shut its sending side too.guest_sce_net,guest_socket_error,guest_udp,guest_select,guest_select_wait,guest_tcp,guest_socket_pairandguest_recvmsg_memorypass.python tools/check_conventions.py --base upstream/main: passes.poll(guest_socket_descriptors,guest_socket_options) were not rerun by me for this change; theirpollcalls do not involve a peer that closed.closeby the peer with unread data.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryAI-assisted (Claude Code).
🤖 Generated with Claude Code