fix(net): keep MSG_DONTWAIT transfers nonblocking on Windows #8653

Merged
Ondra97 merged 4 commits from upstream-pr/8653 into main 2026-10-21 01:19:19 +00:00
Ondra97 commented 2026-10-20 20:05:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-20T20:05:08Z.


What

On Windows, the readiness check before a MSG_DONTWAIT receive could succeed in several threads, then one reader consumed the available byte and another entered a blocking Winsock receive. The regression reproduces this for sceNetRecv, sceNetRecvfrom and sceNetRecvmsg on TCP loopback.

Native Net sockets now stay non-blocking. Transfers return immediately for MSG_DONTWAIT or guest SO_NBIO; ordinary operations retry after readiness until their existing timeout. Blocking stream sends advance through short host writes until the whole buffer is queued. A timeout or host error after progress returns the queued count; a send timeout without progress returns EAGAIN. The original deadline is shared across all partial writes. Blocking connect and accept keep their waiting behavior. Readiness waits retry at most every 10 ms so local shutdown is observed even when Winsock does not wake WSAPoll.

The existing native-socket owner carries an optional provider transfer callback. SSL uses it for Net sockets, retaining the socket's lifetime, current guest mode and timeouts without changing the lookup signature or the SSL session constructor. Kernel sockets retain their existing direct native transport.

The blocking stream completion follows FreeBSD 11.4 sosend_generic. The per-call contract follows FreeBSD recv(2); Winsock documents the socket-wide mode in ioctlsocket. This addresses a host defect identified in the PRAGMATA audit in #8005; it does not establish a game blocker or fix that whole issue.

Tested

Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 UCRT r7, Release, BUILD_TESTING=ON. AMD Ryzen 9 7900X, 32 GB RAM, NVIDIA GeForce RTX 4070 Ti SUPER; GPU unused.

Main base: 5b59fbc5539b6c6db7a26972f6069f1c6cc179ac. Tested code head: c415375041b70c7ea4c127b0b8016892903c7b91. Documentation-only follow-up: 401dee24b6dbfc4d3da865dac59c15ab9d2762af; only docs/dev/debt/libSceNet.md changed after validation. Runtime and test sources are identical.

  • The initial comparison used base 2185dbf92e8d9013a1620d2dfc95de50494e19f8 and original head f29c50766892775df90c689031975e3f432f35f4. The same eight synthetic net_dontwait_* cases have 4 failures on the base and 0 after the fix: the three competing-reader cases and the pending receive after local close fail on the base. Each reader case runs 32 races with eight readers competing for one byte. Send/sendto/sendmsg and duplex controls also check delivered bytes and unchanged guest blocking flags. A full send is permitted when Winsock accepts the entire buffer.

  • Three new net_dontwait_blocking_send, _sendto and _sendmsg tests send a patterned 4 MiB payload to a real loopback reader that drains slowly and verifies every byte. On Windows, test-only wrappers limit each real host send/sendto to 16 KiB to make short writes deterministic. Linux uses the native calls without this limit. Small Winsock buffers alone did not reliably force short writes on this host. The same tests also check a partial count at the original send deadline, EAGAIN without progress, preserved progress on local abort, and a single host result for guest SO_NBIO.

    The baseline is the original PR head f29c507668 composed with main 5b59fbc553, using the same new test source. Each API returns only 16 KiB there; all three tests fail. After the fix, each returns and delivers the full 4 MiB. These are correctness results with controlled host chunk sizes, not a throughput benchmark.

Metric Before (base) After (fix)
Returned bytes per blocking API for a 4,194,304-byte request 16,384 4,194,304
Complete payload verified at the slow reader No Yes
Failed tests among the same 3 blocking-send cases 3 0
  • Full Windows build completed with the exact test-only dependency #8310, head ca55e46f98ad85861dd7567abad0c028274daca1, applied temporarily. Without it, the unchanged main file ImageArrayWindowPastLayerLimit.cpp fails at alignas(65536) because WinLibs supports at most 8192 for a static object. The file's baseline blob is 0d29ae08e46e33c1cd0e931f951befcf42961ec5. The dependency file was restored byte-for-byte and is absent from this PR. The full build is therefore validation with that dependency, not a passing standalone build without it.
  • 54/55 focused CTests passed on the current head, 0 skipped: all eleven net_dontwait_* cases, existing Net/NetCtl/UDP/descriptor/option/select/guest-buffer tests, both SSL transport providers and patched-library loading (354 libraries, zero load failures). guest_poll still aborts on this host in its urgent-TCP priority wait at GuestPoll.cpp:202. I reproduced the same assertion with the original main SocketPoll.hpp and Udp.cpp, using the same test source and host; both runs fail after the outside peer sends MSG_OOB. A temporary source-location diagnostic identified line 204 with its two added includes (original line 202), and every diagnostic file was restored. The test remains enabled and unchanged. This is a reproduced baseline failure, not a passing test or a demonstrated regression of this change; the complete suite command below exits with status 8 because of it.
  • A maintainer-triggered full CI run on the updated head is still required to establish the requested Linux and Windows result, including guest_poll. The independent run in the comments passed guest_poll on another Windows host; I do not count that as a pass for this updated head.
  • python tools/check_conventions.py --base origin/main, python tools/check_test_registration.py ../build and git diff --check pass.
  • python tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch codex/fix-net-dontwait reports an adjacent debt-text conflict with #8598, so I list it first in the merge order. The epoll and transfer implementations are independent. I manually inspected the shared-file patches the checker could not compare in #5021, #5836, #6044, #6879, #6977, #7088, #7201 and #8204; none implements this transport fix. #8541 and #8431 touch separate SSL paths.

Reproduction commands (with the supported toolchain on PATH):

cmake -S . -B ../build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DPython3_EXECUTABLE=C:/Python314/python.exe -DFFMPEG_PREBUILT_DIR=D:/Github/AnyPS5/build-runtime/externals/ffmpeg-9ac4cfd195f1
cmake --build ../build --parallel 6
ctest --test-dir ../build -R "^(net_dontwait_.*|guest_sce_net|guest_net_ctl|guest_datagram_.*|guest_refused_connect|guest_socket_host_write_.*|guest_ssl.*|guest_socket_.*|guest_udp.*|guest_poll.*|guest_select.*|patched_libraries)$" --output-on-failure

No game or original console module was run. Console ordering between competing operations remains unmeasured, and the existing Windows stream-receive timeout error mapping remains documented debt. The 10 ms readiness polling interval is also recorded in the library debt.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #8310, #8598
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4941746955 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8653). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-20T20:05:08Z. --- ### What On Windows, the readiness check before a `MSG_DONTWAIT` receive could succeed in several threads, then one reader consumed the available byte and another entered a blocking Winsock receive. The regression reproduces this for `sceNetRecv`, `sceNetRecvfrom` and `sceNetRecvmsg` on TCP loopback. Native Net sockets now stay non-blocking. Transfers return immediately for `MSG_DONTWAIT` or guest `SO_NBIO`; ordinary operations retry after readiness until their existing timeout. Blocking stream sends advance through short host writes until the whole buffer is queued. A timeout or host error after progress returns the queued count; a send timeout without progress returns `EAGAIN`. The original deadline is shared across all partial writes. Blocking connect and accept keep their waiting behavior. Readiness waits retry at most every 10 ms so local shutdown is observed even when Winsock does not wake `WSAPoll`. The existing native-socket owner carries an optional provider transfer callback. SSL uses it for Net sockets, retaining the socket's lifetime, current guest mode and timeouts without changing the lookup signature or the SSL session constructor. Kernel sockets retain their existing direct native transport. The blocking stream completion follows [FreeBSD 11.4 sosend_generic](https://github.com/freebsd/freebsd-src/blob/releng/11.4/sys/kern/uipc_socket.c#L1160-L1337). The per-call contract follows [FreeBSD recv(2)](https://man.freebsd.org/cgi/man.cgi?manpath=FreeBSD+11.4-RELEASE&query=recv&sektion=2); Winsock documents the socket-wide mode in [ioctlsocket](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-ioctlsocket). This addresses a host defect identified in the PRAGMATA audit in #8005; it does not establish a game blocker or fix that whole issue. ### Tested Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 UCRT r7, Release, `BUILD_TESTING=ON`. AMD Ryzen 9 7900X, 32 GB RAM, NVIDIA GeForce RTX 4070 Ti SUPER; GPU unused. Main base: `5b59fbc5539b6c6db7a26972f6069f1c6cc179ac`. Tested code head: `c415375041b70c7ea4c127b0b8016892903c7b91`. Documentation-only follow-up: `401dee24b6dbfc4d3da865dac59c15ab9d2762af`; only `docs/dev/debt/libSceNet.md` changed after validation. Runtime and test sources are identical. - The initial comparison used base `2185dbf92e8d9013a1620d2dfc95de50494e19f8` and original head `f29c50766892775df90c689031975e3f432f35f4`. The same eight synthetic `net_dontwait_*` cases have 4 failures on the base and 0 after the fix: the three competing-reader cases and the pending receive after local close fail on the base. Each reader case runs 32 races with eight readers competing for one byte. Send/sendto/sendmsg and duplex controls also check delivered bytes and unchanged guest blocking flags. A full send is permitted when Winsock accepts the entire buffer. - Three new `net_dontwait_blocking_send`, `_sendto` and `_sendmsg` tests send a patterned 4 MiB payload to a real loopback reader that drains slowly and verifies every byte. On Windows, test-only wrappers limit each real host `send`/`sendto` to 16 KiB to make short writes deterministic. Linux uses the native calls without this limit. Small Winsock buffers alone did not reliably force short writes on this host. The same tests also check a partial count at the original send deadline, `EAGAIN` without progress, preserved progress on local abort, and a single host result for guest `SO_NBIO`. The baseline is the original PR head `f29c507668` composed with main `5b59fbc553`, using the same new test source. Each API returns only 16 KiB there; all three tests fail. After the fix, each returns and delivers the full 4 MiB. These are correctness results with controlled host chunk sizes, not a throughput benchmark. | Metric | Before (base) | After (fix) | |---|---|---| | Returned bytes per blocking API for a 4,194,304-byte request | 16,384 | 4,194,304 | | Complete payload verified at the slow reader | No | Yes | | Failed tests among the same 3 blocking-send cases | 3 | 0 | - Full Windows build completed with the exact test-only dependency #8310, head `ca55e46f98ad85861dd7567abad0c028274daca1`, applied temporarily. Without it, the unchanged main file `ImageArrayWindowPastLayerLimit.cpp` fails at `alignas(65536)` because WinLibs supports at most 8192 for a static object. The file's baseline blob is `0d29ae08e46e33c1cd0e931f951befcf42961ec5`. The dependency file was restored byte-for-byte and is absent from this PR. The full build is therefore validation with that dependency, not a passing standalone build without it. - 54/55 focused CTests passed on the current head, 0 skipped: all eleven `net_dontwait_*` cases, existing Net/NetCtl/UDP/descriptor/option/select/guest-buffer tests, both SSL transport providers and patched-library loading (354 libraries, zero load failures). `guest_poll` still aborts on this host in its urgent-TCP priority wait at `GuestPoll.cpp:202`. I reproduced the same assertion with the original main `SocketPoll.hpp` and `Udp.cpp`, using the same test source and host; both runs fail after the outside peer sends `MSG_OOB`. A temporary source-location diagnostic identified line 204 with its two added includes (original line 202), and every diagnostic file was restored. The test remains enabled and unchanged. This is a reproduced baseline failure, not a passing test or a demonstrated regression of this change; the complete suite command below exits with status 8 because of it. - A maintainer-triggered full CI run on the updated head is still required to establish the requested Linux and Windows result, including `guest_poll`. The independent run in the comments passed `guest_poll` on another Windows host; I do not count that as a pass for this updated head. - `python tools/check_conventions.py --base origin/main`, `python tools/check_test_registration.py ../build` and `git diff --check` pass. - `python tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch codex/fix-net-dontwait` reports an adjacent debt-text conflict with #8598, so I list it first in the merge order. The epoll and transfer implementations are independent. I manually inspected the shared-file patches the checker could not compare in #5021, #5836, #6044, #6879, #6977, #7088, #7201 and #8204; none implements this transport fix. #8541 and #8431 touch separate SSL paths. Reproduction commands (with the supported toolchain on `PATH`): ```text cmake -S . -B ../build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DPython3_EXECUTABLE=C:/Python314/python.exe -DFFMPEG_PREBUILT_DIR=D:/Github/AnyPS5/build-runtime/externals/ffmpeg-9ac4cfd195f1 cmake --build ../build --parallel 6 ctest --test-dir ../build -R "^(net_dontwait_.*|guest_sce_net|guest_net_ctl|guest_datagram_.*|guest_refused_connect|guest_socket_host_write_.*|guest_ssl.*|guest_socket_.*|guest_udp.*|guest_poll.*|guest_select.*|patched_libraries)$" --output-on-failure ``` No game or original console module was run. Console ordering between competing operations remains unmeasured, and the existing Windows stream-receive timeout error mapping remains documented debt. The 10 ms readiness polling interval is also recorded in the library debt. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #8310, #8598 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-20 20:26:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T20:26:17Z.


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.

Pull request Shared files not compared
PR 5021 core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 5836 core/libs/prx/libSceNet/CMakeLists.txt
core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 6044 core/libs/prx/libSceNet/CMakeLists.txt
PR 6879 core/libs/prx/libSceNet/Export.cpp
PR 6977 core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 7088 core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 7201 core/libs/prx/libSceNet/Export.cpp
core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 8204 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 8658 core/libs/prx/libSceNet/Export.cpp
core/libs/prx/libkernel/Socket/src/Udp.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6300724520 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8653#issuecomment-6300724520). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T20:26:17Z. --- <!-- pr-overlap --> 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. | Pull request | Shared files not compared | |---|---| | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libkernel/Socket/src/Udp.cpp` | | [PR 5836](https://www.github.com/boykopovar/AnyPS5/pull/5836) | `core/libs/prx/libSceNet/CMakeLists.txt`<br>`core/libs/prx/libSceNet/Export.cpp`<br>`docs/dev/debt/libSceNet.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/prx/libSceNet/CMakeLists.txt` | | [PR 6879](https://www.github.com/boykopovar/AnyPS5/pull/6879) | `core/libs/prx/libSceNet/Export.cpp` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libkernel/Socket/src/Udp.cpp` | | [PR 7088](https://www.github.com/boykopovar/AnyPS5/pull/7088) | `core/libs/prx/libkernel/Socket/src/Udp.cpp` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libSceNet/Export.cpp`<br>`core/libs/prx/libkernel/Socket/src/Udp.cpp` | | [PR 8204](https://www.github.com/boykopovar/AnyPS5/pull/8204) | `core/libs/prx/libSceNet/Export.cpp`<br>`docs/dev/debt/libSceNet.md` | | [PR 8658](https://www.github.com/boykopovar/AnyPS5/pull/8658) | `core/libs/prx/libSceNet/Export.cpp`<br>`core/libs/prx/libkernel/Socket/src/Udp.cpp` |
cadenasynyster commented 2026-10-20 21:57:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by cadenasynyster on 2026-10-20T21:57:02Z.


Independent Windows run of this PR.

Environment: Windows 11 10.0.26300 (same build as the PR description), Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7 UCRT, Release, BUILD_TESTING=ON. I built only net_dontwait_tests and guest_poll_tests, so the #8310 workaround was not needed.

Results:

  • PR head: all 8 net_dontwait_* tests pass.
  • Baseline: I kept the PR's tests and CMake and replaced the four production files with their base versions (libSceNet/Export.cpp, libSceSsl/Export.cpp, libkernel/Socket/include/SocketPoll.hpp, libkernel/Socket/src/Udp.cpp). net_dontwait_recv, _recvfrom, _recvmsg and _blocking fail, and the other four pass. This matches the 4-failure count and the cases named in the description. I restored the PR's files afterwards.

guest_poll: the description reports an abort at GuestPoll.cpp:202, reproduced on main. On the PR head it passes here (0.37 s) on this OS build, so that abort looks specific to the author's host.

Not run: other platforms, the SSL provider tests, the full repository CTest, and any title or console run.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6302597018 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8653#issuecomment-6302597018). Originally posted by [cadenasynyster](https://github.com/cadenasynyster) on 2026-10-20T21:57:02Z. --- Independent Windows run of this PR. **Environment:** Windows 11 10.0.26300 (same build as the PR description), Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7 UCRT, Release, BUILD_TESTING=ON. I built only `net_dontwait_tests` and `guest_poll_tests`, so the #8310 workaround was not needed. **Results:** - PR head: all 8 `net_dontwait_*` tests pass. - Baseline: I kept the PR's tests and CMake and replaced the four production files with their base versions (`libSceNet/Export.cpp`, `libSceSsl/Export.cpp`, `libkernel/Socket/include/SocketPoll.hpp`, `libkernel/Socket/src/Udp.cpp`). `net_dontwait_recv`, `_recvfrom`, `_recvmsg` and `_blocking` fail, and the other four pass. This matches the 4-failure count and the cases named in the description. I restored the PR's files afterwards. **`guest_poll`:** the description reports an abort at `GuestPoll.cpp:202`, reproduced on main. On the PR head it passes here (0.37 s) on this OS build, so that abort looks specific to the author's host. **Not run:** other platforms, the SSL provider tests, the full repository CTest, and any title or console run. AI-assisted: yes
oneandonlydean commented 2026-10-20 23:30:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T23:30:13Z.


@Ondra97 Thanks. The race is real, the per-call MSG_DONTWAIT contract is right, and keeping connect and accept blocking keeps the change contained.

One request, about blocking sends now that the native socket is always non-blocking. In native_transfer, any result other than -1/WSAEWOULDBLOCK is returned at once. A non-blocking Winsock send may accept fewer bytes than requested ("the number of bytes sent can be less than the number requested", per the send docs). So a blocking sceNetSend/sceNetSendto/sceNetSendmsg on a stream socket can now return a short count where main's blocking Winsock socket waited. FreeBSD's sosend blocks a blocking stream send until the whole buffer is queued, and returns short only on a timeout, a signal or an error. Code written for that (one send of a whole message, with the count checked only for < 0) would silently lose the tail.

Could the blocking stream path (no MSG_DONTWAIT, SO_NBIO off) keep sending the rest after readiness until it's all queued, the send timeout expires (then return what was sent, or EAGAIN if nothing was), or an error occurs? A test would show it: a blocking sceNetSend of a few MiB to a reader that drains slowly, with the full length returned. The current CheckSend uses MSG_DONTWAIT, where a short count is correct.

A smaller point, not a blocker: every thread blocked in a receive now wakes every 10 ms to notice a local close. A one-line debt note about the polling interval would help whoever looks at idle CPU later.

After that, the bar is a full CI run with the net_dontwait_* tests, guest_poll and the existing libSceNet/libSceSsl tests passing on Linux and Windows.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6304139790 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8653#issuecomment-6304139790). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T23:30:13Z. --- @Ondra97 Thanks. The race is real, the per-call `MSG_DONTWAIT` contract is right, and keeping connect and accept blocking keeps the change contained. One request, about blocking sends now that the native socket is always non-blocking. In `native_transfer`, any result other than `-1`/`WSAEWOULDBLOCK` is returned at once. A non-blocking Winsock `send` may accept fewer bytes than requested ("the number of bytes sent can be less than the number requested", per the `send` docs). So a blocking `sceNetSend`/`sceNetSendto`/`sceNetSendmsg` on a stream socket can now return a short count where `main`'s blocking Winsock socket waited. FreeBSD's `sosend` blocks a blocking stream send until the whole buffer is queued, and returns short only on a timeout, a signal or an error. Code written for that (one `send` of a whole message, with the count checked only for `< 0`) would silently lose the tail. Could the blocking stream path (no `MSG_DONTWAIT`, `SO_NBIO` off) keep sending the rest after readiness until it's all queued, the send timeout expires (then return what was sent, or `EAGAIN` if nothing was), or an error occurs? A test would show it: a blocking `sceNetSend` of a few MiB to a reader that drains slowly, with the full length returned. The current `CheckSend` uses `MSG_DONTWAIT`, where a short count is correct. A smaller point, not a blocker: every thread blocked in a receive now wakes every 10 ms to notice a local close. A one-line debt note about the polling interval would help whoever looks at idle CPU later. After that, the bar is a full CI run with the `net_dontwait_*` tests, `guest_poll` and the existing libSceNet/libSceSsl tests passing on Linux and Windows.
Ondra97 commented 2026-10-21 00:02:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-21T00:02:38Z.


@oneandonlydean I fixed the blocking stream path in c415375041. It advances through short host writes with one deadline for the whole call, returns queued bytes on timeout or error, and returns EAGAIN when the send times out without progress. MSG_DONTWAIT, guest SO_NBIO and datagram sends keep their single-transfer behavior. I also added the debt note about the 10 ms readiness polling interval.

The three new send/sendto/sendmsg tests use a real TCP loopback reader and a 4 MiB patterned payload. Test-only Windows wrappers cap each actual host send at 16 KiB, since small socket buffers alone did not reliably force a short write here. The original-head/current-main composition returns only 16 KiB in all three cases; the fix returns and delivers all 4 MiB. Timeout with and without progress, local abort, and guest nonblocking mode also pass. All 11 net_dontwait_* cases pass.

The full Windows build completes with the already-declared #8310 test-only dependency, restored afterwards. The focused suite is 54/55 with no skips, including both SSL transport providers; guest_poll still fails on this host in the previously documented urgent-TCP case reproduced on main. I have kept that test enabled and documented the failure. This still needs the full Linux and Windows CI run you requested; I am not claiming that bar has passed locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6304573991 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8653#issuecomment-6304573991). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-21T00:02:38Z. --- @oneandonlydean I fixed the blocking stream path in [c415375041](https://github.com/boykopovar/AnyPS5/commit/c415375041b70c7ea4c127b0b8016892903c7b91). It advances through short host writes with one deadline for the whole call, returns queued bytes on timeout or error, and returns `EAGAIN` when the send times out without progress. `MSG_DONTWAIT`, guest `SO_NBIO` and datagram sends keep their single-transfer behavior. I also added the debt note about the 10 ms readiness polling interval. The three new send/sendto/sendmsg tests use a real TCP loopback reader and a 4 MiB patterned payload. Test-only Windows wrappers cap each actual host send at 16 KiB, since small socket buffers alone did not reliably force a short write here. The original-head/current-main composition returns only 16 KiB in all three cases; the fix returns and delivers all 4 MiB. Timeout with and without progress, local abort, and guest nonblocking mode also pass. All 11 `net_dontwait_*` cases pass. The full Windows build completes with the already-declared #8310 test-only dependency, restored afterwards. The focused suite is 54/55 with no skips, including both SSL transport providers; `guest_poll` still fails on this host in the previously documented urgent-TCP case reproduced on main. I have kept that test enabled and documented the failure. This still needs the full Linux and Windows CI run you requested; I am not claiming that bar has passed locally.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!8653
No description provided.