Skip to content

[DONTMERGE] Test run with reproducer for forced chunked recv - #36751

Closed
optout21 wants to merge 2 commits into
bitcoin:masterfrom
optout21:2610-net-recv-chunks-reproducer
Closed

optout21 wants to merge 2 commits into
bitcoin:masterfrom
optout21:2610-net-recv-chunks-reproducer

Conversation

@optout21

@optout21 optout21 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

WARNING: NOT INTENDED FOR MERGING!

Performing a test run with forced chunked recv.

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 read, recv() is not called to read all available data, but data is read and returned in smaller chunks. 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).

Similar to #36724 .

WARNING: NOT INTENDED FOR MERGING!

@DrahtBot

DrahtBot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

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.

@optout21
optout21 force-pushed the 2610-net-recv-chunks-reproducer branch from f96de08 to e17e983 Compare November 4, 2026 07:54
@DrahtBot

DrahtBot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🚧 At least one of the CI tasks failed.
Task macOS native: https://github.com/bitcoin/bitcoin/actions/runs/41794882715/job/126456522377
LLM reason (✨ experimental): CI failed because the sock_tests CTest test failed.

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.

@optout21

optout21 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

A socket unit test failed (sock_tests/send_and_receive), so integration tests were not executed.
Including a commit with a fix for the unit test, for a 2nd run.

test/sock_tests.cpp(132): error: in "sock_tests/send_and_receive": check receiver.Recv(recv_buf, sizeof(recv_buf), 0) == msg_len has failed [1 != 4]
test/sock_tests.cpp(133): error: in "sock_tests/send_and_receive": check strncmp(msg, recv_buf, msg_len) == 0 has failed [1 != 0]
test/sock_tests.cpp(132): error: in "sock_tests/send_and_receive": check receiver.Recv(recv_buf, sizeof(recv_buf), 0) == msg_len has failed [1 != 4]
test/sock_tests.cpp(133): error: in "sock_tests/send_and_receive": check strncmp(msg, recv_buf, msg_len) == 0 has failed [-1 != 0]

@optout21
optout21 force-pushed the 2610-net-recv-chunks-reproducer branch from 0ec8469 to 7148dc4 Compare November 4, 2026 12:55
@optout21

optout21 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

CI runs timed out, in some cases a log line is created for every read, and the many small chunks slowed down runs considerably. In local runs this didn't cause a problem.
I've changed the reproducer to break up less aggressively: for large streams always read the third of the available data at once. I hope this will make a difference.

@optout21
optout21 force-pushed the 2610-net-recv-chunks-reproducer branch from 7148dc4 to d0f84b6 Compare November 4, 2026 22:09
A stress test reproducer. For every socket read, read data in smaller
recv() calls.
Instead of performing a recv for up to the available buffer size normally,
break it up into smaller recv()'s, in order to stress test code paths.
WARNING: Only for testing purposes, not to be merged!
@optout21

optout21 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

CI runs have completed, with some failures (as expected).

Added failed cases to #36726 -- sock_tests/send_and_receive unit test, interface_http.py,feature_torcontrol.py.

Closing this PR (it was not intended for merging, keeping it for reference).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants