fix(libkernel): report EPIPE for a stream send after the peer closed on Windows #5510
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5510"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-13T21:49:56Z.
What
On Windows, a
sendorwriteon a stream socket whose peer has closed fails withECONNABORTED(53) orECONNRESET(54), because Winsock reportsWSAECONNABORTED/WSAECONNRESETandNativeErrormaps them by name. FreeBSD 11.4 reportsEPIPE(32):sosend_genericchecksSBS_CANTSENDMOREbeforeso_error, and the peer's reset sets it throughsoisdisconnected. A guest that checks forEPIPEto notice a dropped connection did not see it on Windows.SendError(used bysend,sendtoand so bywrite/_writeon a guest socket) now returnsEPIPEfor those two errors on a stream socket on Windows, as it already does forWSAESHUTDOWN. Datagram sockets and Linux are unchanged.The two checks that were Linux-only for this reason now run on Windows too: the
writeloop after the peer'scloseinguest_socket_read_write, and thesendloop inguest_tcp. Thelibkernel.mddebt entries are updated: "Socket error numbers" records the mapping, and "socketpair" no longer says a streamsendafter the peer closed reportsECONNABORTED; on Windows the first such send still succeeds (the pair is a loopback TCP connection), and the next one now reportsEPIPE.sendfile'sSendAllstill usesNativeError; it is not covered by a test here, so it is left for a follow-up.Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, full build, on
main665ad7da7:main'sUdp.cppand the checks enabled:guest_socket_read_writefails at thewriteloop (errno 53on the second write).guest_tcppasses either way, since itssendloop follows a localshutdown(SHUT_WR)(WSAESHUTDOWN).guest_tcp,guest_socket_read_write,guest_socket_pair,guest_sce_net,guest_pollandguest_udppass 20/20 (--repeat until-fail:20); fullctest1099/1099.socketpairstream end after the peer'sclose(not committed): firstsendsucceeds, second fails withEPIPE(3/3 runs); before the change the second failed withECONNABORTED.#ifdef _WIN32.tools/check_conventions.py --base upstream/mainpasses.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T22:15:06Z.
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.
main)docs/dev/debt/libkernel.mdL154docs/dev/debt/libkernel.mdL153-154docs/dev/debt/libkernel.mdL153-154docs/dev/debt/libkernel.mdL148Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:25:44Z.
Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.
Pull request closed