WIP: [DONTMERGE] Test run with reproducer for forced chunked send #36724

Closed
optout21 wants to merge 8 commits from 2610-net-send-chunks-reproducer into master AGit
optout21 commented 2026-11-02 08:59:37 +00:00 (Migrated from github.com)

WARNING: NOT INTENDED FOR MERGING!

Performing a test run with forced chunked send.

All networking code using sockets must not make assumption about the chunking of the incoming/outgoing data, and should be resilient against any chunking. Normally, the chunking of the sends of the writer dictate the chunking of the receives at the reader, but this is not guaranteed by IP/TCP, intermediate networking elements may change the packet structure.

This branch contains a stress test reproducer. For every socket send, sending is changed to break up data in small chunks. This forcedly changes chunking of the data stream. The goal is to test code for robustness in face of unexpected chunking of the data.

This PR will be closed once the test runs complete, and kept for reference (some tests are expected to fail).

WARNING: NOT INTENDED FOR MERGING!

WARNING: NOT INTENDED FOR MERGING! Performing a test run with forced chunked send. All networking code using sockets must not make assumption about the chunking of the incoming/outgoing data, and should be resilient against any chunking. Normally, the chunking of the sends of the writer dictate the chunking of the receives at the reader, but this is not guaranteed by IP/TCP, intermediate networking elements may change the packet structure. This branch contains a stress test reproducer. For every socket send, sending is changed to break up data in small chunks. This forcedly changes chunking of the data stream. The goal is to test code for robustness in face of unexpected chunking of the data. This PR will be closed once the test runs complete, and kept for reference (some tests are expected to fail). WARNING: NOT INTENDED FOR MERGING!
DrahtBot commented 2026-11-02 08:59:46 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.
A summary of reviews will appear here.

LLM Linter (✨ experimental)

Possible places where comparison-specific test macros should replace generic comparisons:

  • test/functional/interface_http.py: assert res.index(b"HTTP/1.1 200") < res.index(b"HTTP/1.1 400") → Prefer assert_greater_than(res.index(b"HTTP/1.1 400"), res.index(b"HTTP/1.1 200")).

2026-11-13 06:38:27

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36724 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36724.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36724#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. A summary of reviews will appear here. <!--5faf32d7da4f0f540f40219e4f7537a3--> ### LLM Linter (✨ experimental) Possible places where comparison-specific test macros should replace generic comparisons: - `test/functional/interface_http.py`: `assert res.index(b"HTTP/1.1 200") < res.index(b"HTTP/1.1 400")` → Prefer `assert_greater_than(res.index(b"HTTP/1.1 400"), res.index(b"HTTP/1.1 200"))`. <sup>2026-11-13 06:38:27</sup>
First-time contributor

1 additional verified finding in the Review report.

🟠 Minor · Forced chunking changes datagram message boundaries

With port mapping enabled, this DONTMERGE build sends malformed UDP and netlink requests; a possible netlink shutdown hang additionally depends on unverified kernel behavior.

Location: src/util/sock.cpp:61 (head).

🔵 Suggestion · The v2 setban exclusion lacks a failure explanation

The exclusion lacks a failure log or cause, leaving the source-inferred early-close explanation unconfirmed and preventing readers from distinguishing reproducer effects from a robustness bug.

Location: test/functional/test_runner.py:251 (base).

🔵 Suggestion · Forwarded MSG_MORE works against forced fragmentation

On Linux, retaining MSG_MORE encourages coalescing of the forced v1 header chunks, reducing opportunities to exercise split-header parsing; the actual packetization in this run was not measured.

Location: src/util/sock.cpp:64 (head).

🔵 Suggestion · Python-to-node traffic bypasses the chunking hook

The hook leaves general Python-to-node writes unfragmented, limiting receive-side stress in Python-driven tests even though node-to-node traffic and selected explicit split-input cases still exercise node readers.

Location: src/util/sock.cpp:72 (head).

🔵 Suggestion · Split-handshake fixes lack deterministic regression coverage

The Python responder fixes depend on uncommon random inputs and read boundaries that no checked-in test forces, so regressions can escape CI after the reproducer is removed.

Location: test/functional/test_framework/v2_p2p.py:142 (head).

🔵 Suggestion · The slow-read drain retains every large response body

check_slow_read_throttle now retains and copies tens of MiB of response bodies merely to count responses, increasing functional-test memory pressure; no resource failure or peak-memory measurement was observed.

Location: test/functional/interface_http.py:117 (head).

Review coverage was incomplete.


Reviewed: b45fa0069d5c · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:464886e574fc96b3587e582688c29b6bd7a73bba755cfc1d2f031cc648c7ec97:a99dfe27a5d9c587aaf93be1a4842812699d6122d1d9babba7210869336cc02c --> <!-- ralph-base:9183edd25e60aa410bc3e4728989a1d75c309a09 --> <!-- ralph-head:b45fa0069d5c2f81965c9c0b178f1500c1ec8db3 --> <!-- ralph-case:44d341703a5239474c30a738f24a69720d86748b63e9cd76ef96e2906ac193a9 --> [1 additional verified finding in the Review report](<https://review.fish.foo/report/36724-b45fa0069d5c2f81965c9c0b178f1500c1ec8db3-2624-6.html>). **🟠 Minor · Forced chunking changes datagram message boundaries** With port mapping enabled, this DONTMERGE build sends malformed UDP and netlink requests; a possible netlink shutdown hang additionally depends on unverified kernel behavior. Location: [`src/util/sock.cpp:61`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/b45fa0069d5c2f81965c9c0b178f1500c1ec8db3/src/util/sock.cpp#L61>) (head). **🔵 Suggestion · The v2 setban exclusion lacks a failure explanation** The exclusion lacks a failure log or cause, leaving the source-inferred early-close explanation unconfirmed and preventing readers from distinguishing reproducer effects from a robustness bug. Location: [`test/functional/test_runner.py:251`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/9bf4815b94b9eaf8807f4e569091778da6c338d5/test/functional/test_runner.py#L251>) (base). **🔵 Suggestion · Forwarded MSG_MORE works against forced fragmentation** On Linux, retaining `MSG_MORE` encourages coalescing of the forced v1 header chunks, reducing opportunities to exercise split-header parsing; the actual packetization in this run was not measured. Location: [`src/util/sock.cpp:64`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/b45fa0069d5c2f81965c9c0b178f1500c1ec8db3/src/util/sock.cpp#L64>) (head). **🔵 Suggestion · Python-to-node traffic bypasses the chunking hook** The hook leaves general Python-to-node writes unfragmented, limiting receive-side stress in Python-driven tests even though node-to-node traffic and selected explicit split-input cases still exercise node readers. Location: [`src/util/sock.cpp:72`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/b45fa0069d5c2f81965c9c0b178f1500c1ec8db3/src/util/sock.cpp#L72>) (head). **🔵 Suggestion · Split-handshake fixes lack deterministic regression coverage** The Python responder fixes depend on uncommon random inputs and read boundaries that no checked-in test forces, so regressions can escape CI after the reproducer is removed. Location: [`test/functional/test_framework/v2_p2p.py:142`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/b45fa0069d5c2f81965c9c0b178f1500c1ec8db3/test/functional/test_framework/v2_p2p.py#L142>) (head). **🔵 Suggestion · The slow-read drain retains every large response body** `check_slow_read_throttle` now retains and copies tens of MiB of response bodies merely to count responses, increasing functional-test memory pressure; no resource failure or peak-memory measurement was observed. Location: [`test/functional/interface_http.py:117`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/b45fa0069d5c2f81965c9c0b178f1500c1ec8db3/test/functional/interface_http.py#L117>) (head). Review coverage was incomplete. <!-- Review tier: sensitive --> --- Reviewed: [`b45fa0069d5c`](<https://git.fish.foo/bitcoin/bitcoin/commit/b45fa0069d5c2f81965c9c0b178f1500c1ec8db3>) · [Review report](<https://review.fish.foo/report/36724-b45fa0069d5c2f81965c9c0b178f1500c1ec8db3-2624-6.html>) · [Previous reports](<https://review.fish.foo/traces/36724/>) [permalink](<https://review.fish.foo/report/36724-b45fa0069d5c2f81965c9c0b178f1500c1ec8db3-2624-6.html>)
DrahtBot commented 2026-11-02 10:08:37 +00:00 (Migrated from github.com)

🚧 At least one of the CI tasks failed.
Task iwyu: https://github.com/bitcoin/bitcoin/actions/runs/41417100283/job/125183540072
LLM reason (✨ experimental): CI failed because IWYU required adding <thread> to src/util/sock.cpp, leaving a diff that the include-check rejects.

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

<!--85328a0da195eb286784d51f73fa0af9--> 🚧 At least one of the CI tasks failed. <sub>Task `iwyu`: https://github.com/bitcoin/bitcoin/actions/runs/41417100283/job/125183540072</sub> <sub>LLM reason (✨ experimental): CI failed because IWYU required adding `<thread>` to `src/util/sock.cpp`, leaving a diff that the include-check rejects.</sub> <details><summary>Hints</summary> Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example: * Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch. * A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test. * An intermittent issue. Leave a comment here, if you need help tracking down a confusing failure. </details>
optout21 commented 2026-11-02 10:38:41 +00:00 (Migrated from github.com)

CI runs have completed, with some failures (that was expected).
An issue has been raised to document the failed tests -- #36726 .
Closing this PR (it was not intended for merging, keeping it for reference).

CI runs have completed, with some failures (that was expected). An issue has been raised to document the failed tests -- #36726 . Closing this PR (it was not intended for merging, keeping it for reference).
optout21 commented 2026-11-12 11:41:37 +00:00 (Migrated from github.com)

New test run, with candidate test fixed on top of the reproducer.
The branch now includes:

Result: some failures:

  • p2p_v2_misbehaving.py: failed, due to similar reason as rpc_setban.py (new failure, failed in several runs)
  • iwyu failure, due to the reproducer commit
New test run, with candidate test fixed on top of the reproducer. The branch now includes: - Force send reproducer -- b37819f86d5a54195f95d01344534d5c7e5a51df - `interface_http.py` fix -- f89bd7f5a5843e84ae66be2bde791f0a2ae5dd41 and 568d8f23edb28368b140be1c6c0fee24b43252d7 from #36729 - ignore `rpc_setban.py --v2transport` -- ba709b5db5491ff03a5f6a89b8cc34b56397f4d0 from https://github.com/optout21/bitcoin/tree/2611-dontmerge-ignore-setban-ftest - `p2p_v2_encrypted.py` fix -- b54ef805e8225616f293a5b9b76e097dc94aab08 from #36730 Result: some failures: - `p2p_v2_misbehaving.py`: failed, due to similar reason as `rpc_setban.py` (new failure, failed in several runs) - iwyu failure, due to the reproducer commit
optout21 commented 2026-11-12 16:43:00 +00:00 (Migrated from github.com)

New test run, with candidate test fixed on top of the reproducer.
The branch (04af897395) now includes:

Results: previous errors resolved (p2p_v2_misbehaving.py and IWYU), failures:

  • New failure in p2p_handshake.py --v2transport
  • test ancestor commits failed, this is due to inconsistent intermediary state, normal.
New test run, with candidate test fixed on top of the reproducer. The branch (04af8973955b5a4080aceaa0bb5febe2a0306e55) now includes: - Force send reproducer -- ab198d7d9c36b59b0370a8cf3d39980795ee06b9 - `interface_http.py` fix -- f89bd7f5a5843e84ae66be2bde791f0a2ae5dd41 and 568d8f23edb28368b140be1c6c0fee24b43252d7 from #36729 - ignore `rpc_setban.py --v2transport` -- ba709b5db5491ff03a5f6a89b8cc34b56397f4d0 from https://github.com/optout21/bitcoin/tree/2611-dontmerge-ignore-setban-ftest - Fix for `p2p_v2_encrypted.py` & `p2p_v2_misbehaving.py` -- be35cbb0b16d97e82f5634e76314e87b430a9360 and be88a3b926bd18d2243ca1a2e21332bca4f5d7e1 from #36730 Results: previous errors resolved (`p2p_v2_misbehaving.py` and IWYU), failures: - New failure in `p2p_handshake.py --v2transport` - `test ancestor commits` failed, this is due to inconsistent intermediary state, normal.
optout21 commented 2026-11-13 06:39:39 +00:00 (Migrated from github.com)

New test run, with candidate test fixed on top of the reproducer.

The branch now (b45fa0069d) includes:

Result: all tests passed, except "test ancestor commit" (as expected, due to the fact that incomplete-commit states fail due to the reproducer).

New test run, with candidate test fixed on top of the reproducer. The branch now (b45fa0069d5c2f81965c9c0b178f1500c1ec8db3) includes: - Force send reproducer -- ab198d7d9c36b59b0370a8cf3d39980795ee06b9 - `interface_http.py` fix -- f89bd7f5a5843e84ae66be2bde791f0a2ae5dd41 and 568d8f23edb28368b140be1c6c0fee24b43252d7 from #36729 - ignore `rpc_setban.py --v2transport` -- ba709b5db5491ff03a5f6a89b8cc34b56397f4d0 from https://github.com/optout21/bitcoin/tree/2611-dontmerge-ignore-setban-ftest - `p2p_v2_encrypted.py` & `p2p_v2_misbehaving.py` fixes -- 4 commits from #36730 (be35cbb, be788a9, baafaf8, ba7dde0) Result: **all tests passed**, except "test ancestor commit" (as expected, due to the fact that incomplete-commit states fail due to the reproducer).
optout21 commented 2026-11-13 10:15:50 +00:00 (Migrated from github.com)

Closing.

Closing.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36724
No description provided.