Skip to content

test: throttle large orphan transactions while being sent in RPCs - #34847

Closed
rkrux wants to merge 126 commits into
bitcoin:masterfrom
rkrux:orphan-handling
Closed

rkrux wants to merge 126 commits into
bitcoin:masterfrom
rkrux:orphan-handling

Conversation

@rkrux

@rkrux rkrux commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

Addresses #34731

Reasons why I don't believe it is a deadlock issue based on the debug logs and debugger thread backtrace output shared in the issue:

  • The HTTP worker threads (b-http_pool_x) are waiting on the condition variable and not on the mutex that signals that these threads are idle & waiting for work to be assigned to them.
  • The HTTP thread (b-http) is epoll waiting that means it is waiting for a request (or a part of it) to be received.
  • The added logs show that the first few testmempool RPCs were successful and the next one timed out. But the logs don't show a request for it being logged unlike in the previous ones, hinting that the server never received such a request (or in full) and thus never processed it. Even then the functional test client timed out, which means that it did send it (at least a part of it).
  • The large orphan transactions being sent are each 780KB in size that are sent sequentially by the test. It tries to send 60 of them in a loop amounting to 46MB of data over a single HTTP connection that is reused.

More details are shared in the first commit message.

This PR throttles the RPCs on client side. I've not been able to reproduce this intermittent issue and thus I don't gurantee that this fixes the issue altogether.

Note: A previous approach in this PR tried to not reuse the HTTP connection for the RPCs in this test instead. But I noticed a CI run where this affected test took around 75mins to complete that led me to move to this approach where the HTTP connection is reused like before but with some throttling.

@DrahtBot DrahtBot added the Tests label Mar 18, 2026
@DrahtBot

DrahtBot commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

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

Reviews

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #34943 (ci: add delay between commits while testing all ancestor commits by rkrux)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

LLM Linter (✨ experimental)

Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

  • evbuffer_peek(buf, -1, nullptr, v, 8) in src/httpserver.cpp

2026-04-02 08:06:24

@rkrux

rkrux commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

Is this job CI / macOS native (pull_request) stuck? It was started 1.5hrs back.

@rkrux

rkrux commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

Can the CI / macOS native (pull_request) job be re-run? It was cancelled after being stuck for 120 mins.

@maflcko

maflcko commented Mar 18, 2026

Copy link
Copy Markdown
Member

I don't think the issue happens in macOS, but only in the task that tests ancestor commits, but that task is skipped for pull requests with one commit. Also, reproducing requires tens of runs/commits.

@hebasto

hebasto commented Mar 18, 2026

Copy link
Copy Markdown
Member

Can the CI / macOS native (pull_request) job be re-run? It was cancelled after being stuck for 120 mins.

Done.

@rkrux

rkrux commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor Author

I don't think the issue happens in macOS, but only in the task that tests ancestor commits,

Oh interesting, I do have a second commit that I will push after this recently started job ends/succeeds.

Also, reproducing requires tens of runs/commits.

I'm not trying to reproduce the issue. Just ensuring that the tests don't fail for some other reason on this commit. Will undraft the PR once the CI is green (or not yellow at least).

@rkrux
rkrux force-pushed the orphan-handling branch 2 times, most recently from 143e2c7 to 531f175 Compare March 18, 2026 14:31
@rkrux rkrux changed the title test: work in progress commit test: conditionally throttle large testmempoolaccept rpcs in p2p_orphan_handling test Mar 18, 2026
@rkrux

rkrux commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

A previous instance of the CI run where the test took 4536s (~75min) to complete when the HTTP connection was not reused and a fresh one was created for every RPC in the test: ASan + LSan + UBSan + integer

@rkrux
rkrux marked this pull request as ready for review March 18, 2026 15:16
@rkrux
rkrux force-pushed the orphan-handling branch from 531f175 to b309bdb Compare March 19, 2026 08:45
Comment thread test/functional/p2p_orphan_handling.py Resolved

@CyberNFT CyberNFT left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@rkrux
rkrux force-pushed the orphan-handling branch from b309bdb to e73640b Compare March 19, 2026 13:15
@rkrux rkrux changed the title test: conditionally throttle large testmempoolaccept rpcs in p2p_orphan_handling test test: throttle large testmempoolaccept rpcs in p2p_orphan_handling test Mar 19, 2026
@rkrux
rkrux force-pushed the orphan-handling branch from e73640b to 650c991 Compare March 19, 2026 13:17
@rkrux
rkrux force-pushed the orphan-handling branch from 650c991 to a2d12cd Compare March 27, 2026 08:37
@rkrux
rkrux marked this pull request as draft March 27, 2026 08:37
@rkrux
rkrux force-pushed the orphan-handling branch 2 times, most recently from 32447ee to d431383 Compare March 27, 2026 09:47
@rkrux rkrux changed the title test: throttle large testmempoolaccept rpcs in p2p_orphan_handling test test: throttle large orphan transactions while being sent in RPCs Mar 27, 2026
@rkrux
rkrux marked this pull request as ready for review March 27, 2026 10:23
@rkrux

rkrux commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

I am not satisfied with the solution of adding some delay between each such affected RPC call, I'm closing this PR.

@rkrux rkrux closed this Apr 7, 2026
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.

5 participants