test(net): bound Linux blocking-send receiver buffer #8922
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8922"
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 MarcZX10 on 2026-10-21T06:14:32Z.
What
Set a small receive buffer on the Linux receiver in the timed-send test. The timeout case deliberately leaves the peer unread; a 1 MiB receive window lets Linux autotune buffer more data than the test's 16 retries expect, so those sends can all make progress. Limiting that test case to 4 KiB makes the peer's receive queue fill predictably and keeps the EAGAIN assertion focused on send timeout behavior. Windows retains its existing buffer setup.
Tested
python3 tools/check_conventions.py --base upstream/main --head HEADpassed.git diff --checkpassed.net_dontwait_blocking_{send,sendto,sendmsg}test binaries; this checkout has no configured full build.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 MarcZX10 on 2026-10-21T06:16:03Z.
Disclosure: this overlaps the earlier-open #8918, which also fixes #8917 in
NetBlockingSend.cppby increasing the retry bound. I missed it during my duplicate check. #8918 includes exact Linux and Windows test runs; this PR proposes the alternative of constraining the Linux receiver buffer for the unread-peer timeout case. The two approaches should be compared and only one needs to land.Imported from boykopovar/AnyPS5. Originally posted by veosett on 2026-10-21T08:56:02Z.
Independent Windows/Linux comparison of the two alternatives for #8917: #8918 at
aa56b002285182763ac422483bd384d309568ee5and #8922 atde573c6d1ef287fe20a5e90f728712fef8e3bb0c.Each unchanged patch was applied separately to the same current
main,f894ba69d30055259a56907563f438379d1275a3. The local integration commits were704bf4ae1ea7b1981df172820b5ec30f6526e8ecfor #8918 and3e1fbde9a8ec0767ce474d0eb28efaf58bb27fbafor #8922. Each diff contains only its originalNetBlockingSend.cppchange. These are integration results on the newer main, rather than builds of the PRs' older bases.Release builds succeeded on Ubuntu 24.04 WSL (GCC 13.3) and Windows 11 Pro 10.0.26100 (supported WinLibs GCC 15.2.0 r7).
peer never exhausted the send buffersEvery candidate run delivered and compared all 4,194,304 payload bytes and passed the existing timeout, abort and guest-nonblocking assertions. There were no skips or CTest timeouts. The longest affected candidate invocation across both hosts and patches was 5.10 s, within the unchanged 20 s timeout.
The eight neighboring
net_dontwait_{send,sendto,sendmsg,recv,recvfrom,recvmsg,duplex,blocking}tests andguest_sce_netalso passed once each on both hosts, on main and the #8922 integration. Those nine neighbors were not rerun for #8918.Linux already had the reported limits:
net.ipv4.tcp_rmem = 4096 131072 33554432,net.ipv4.tcp_wmem = 4096 16384 4194304, and bothnet.core.rmem_maxandnet.core.wmem_maxwere 4194304. These settings were read without changing them.Main used the same commands without the repeat option. Both alternatives fix the reproduced Linux failure in this environment; only one needs to land. I favor #8922 for this fixture because it explicitly bounds the unread receiver queue in the timeout case, keeping the existing retry budget.
No full suite, macOS, title or console run, and no claim of a production networking change. AI-assisted verification; I ran the builds and tests locally.
Imported from boykopovar/AnyPS5. Originally posted by 00xDisaster on 2026-10-21T13:53:46Z.
Independent Linux validation of this exact branch (
de573c6d1): GCC 16.2.1, Release, x86-64. I rebuiltnet_blocking_send_testsand ran the full trio:Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-21T18:35:00Z.
I looked into why these three started failing on GitHub-hosted runners, since every hosted test run of a PR hits them now. Two things that may help whichever of #8918 and this one lands:
The trigger is the runner kernel, not
tcp_rmemautotuning. The ubuntu-24.04 image my fork's runs got (20261018.339) is the first on kernel7.0.0-1017-azure. Since Linux 6.18 (a6d4f25888b8),net.core.rmem_maxdefaults to 4 MiB instead of 208 KiB. The test sets the receiver'sSO_RCVBUFto 1 MiB after accept. Linux caps the request atrmem_maxand doubles it, so it used to end up at 416 KiB and now takes full effect at 2 MiB. SettingSO_RCVBUFalso turns autotuning off, sotcp_rmemplays no part: with its maximum at 32 MiB nothing changed. The peer fills slowly because the window never scales (the listener's 4 KiB buffer is set before the handshake) and an unread receiver acknowledges only on its delayed-ACK timer. Each 100 ms send then moves 64 to 98 KiB and returns partial. With the 2 MiB buffer the firstEAGAINcame on attempt 22 in 3 of 3 runs, so 16 attempts aren't enough and 64 happen to be. With the receiver at 4 KiB, as here, the second timed send returnsEAGAIN. I measured this in an x86-64 container under Rosetta on a Linux 6.8 VM, emulating the larger limit with a preload shim that turnsSO_RCVBUFintoSO_RCVBUFFORCE. With the shim, the realnet_blocking_send_testsfails 3 of 3 with "peer never exhausted the send buffers"; without it the test passes.The abort block has a separate race that neither PR touches. It aborts after a fixed 50 ms wait, but nothing checks that the send has reached the host by then. In one trace
shutdownran 122 ms beforesendtostarted, so the send gotEPIPEand the test failed with "error discarded queued bytes". On hosted runners this never shows because the second block fails first. With this PR's change alone I saw it in 3 of 36 local runs. Waiting until the receiver can peek a byte before the 50 ms check fixed it for me:With that, this PR's
SO_RCVBUFline, and an 8 s deadline in place of the 16 attempts, the three tests passed 36 of 36 runs, at the stock limit and with the shim. The deadline is optional; with the 4 KiB receiver the loop ends on its second send anyway.I'm happy for the peek to go into this PR or into a follow-up after it, whichever you prefer. I won't open a competing PR for the same file.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-21T19:39:59Z.
Checked the 4 KiB receive buffer on the unread-peer timeout case (Linux only, Windows unchanged), the option constants used by the file, and the independent Linux/Windows runs by @veosett and @00xDisaster (main fails 3/3 on Linux, this head passes); merged. This supersedes #8918, which fixes the same #8917 with a different approach.