macOS: sceNetConnect with a connect timeout to a bound, non-listening loopback port returns EAGAIN, not ECONNREFUSED #22317
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Jazeupoi on 2026-11-17T11:58:56Z.
What happens
On macOS,
guest_sce_netfails withguest_sce_net check failed at line 1187, sceNet errno 35: asceNetConnectwith the connect timeout (0x1109) set to a loopback port that is bound but not listening returnsEAGAINafter the timeout instead ofECONNREFUSED(61).Title, test or build step
guest_sce_netAnyPS5 commit
maine798a424c7with #17425 and #11049 merged (needed for the macOS build).System
macOS 27.0.1, Apple M4 (GPU not used by this test), Apple clang 21.0.0 (SDK 27.2), x86-64 Release build under Rosetta 2.
Steps to reproduce
It fails after the 1.5 s connect timeout.
Log
What was checked
Same result every run on this Mac.
The check binds
connect-timeout-closedto 127.0.0.1 without listening, then connectsconnect-timeout-refusedto that address with a 1,500,000 µs connect timeout and expectsECONNREFUSED.connect_withininlibSceNet/Export.cppwaits for the nonblocking connect withpoll, and whenpolltimes out the connect fails withEAGAIN.XNU sends no reset for a SYN to a port that is bound but not listening; it drops it. A host program on this Mac (x86-64 under Rosetta), nonblocking
connectthenpoll(POLLOUT, 1500):pollSO_ERRORlistenPOLLHUPECONNREFUSED)So on macOS a connect to such a port only ever times out. A blocking
sceNetConnectwithout a timeout would wait for the host's TCP connect timeout.No open PR or issue covers this. #17878 and #17879 fix other macOS socket checks and mention
guest_sce_netonly as a remaining failure.Possible directions: on macOS, fail a connect to a local address whose port a guest socket holds without listening with
ECONNREFUSED, as FreeBSD's reset would; or, if only the test's setup matters, aim the check at a port no socket holds. I haven't written either, since the first changesconnectfor every caller.AI-assisted: yes (Claude Code)