mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:08:38 +00:00
test: Fix intermittent issue in p2p_orphan_handling.py #36617
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36617
Loading…
Reference in a new issue
No description provided.
Delete branch "2610-test-fix-int-orphan"
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?
Turns out https://github.com/bitcoin/bitcoin/pull/32092 was incomplete and the issue can still happen:
https://github.com/bitcoin/bitcoin/actions/runs/39809026827/job/119929911875#step:14:14454
The basic idea is that peer1 disconnects to clear its orphan state. This happens in
DisconnectNodes->DeleteNode->FinalizeNode->TxDownloadManager::DisconnectedPeer.In my prior fix, I assumed that
DisconnectNodesin thenetthread would be possible to sync on via a ping-pong. However, the msghand thread may hold a reference to the node, preventing deletion and only moving the node tom_nodes_disconnected. Afterward, thenetthread may hand the pings to themsghandthread and go to sleep for a bit.Thus, the test proceed and cause a split
getdata, meaning thatpeer2.wait_for_parent_requests([int(parent_peekaboo_AB["txid"], 16), int(parent_missing["txid"], 16)])fails.Fix this by just waiting for
TxDownloadManager::DisconnectedPeerto have happened viaself.wait_until(lambda: len(node.getorphantxs(verbosity=2)[0]["from"]) == 1).Edit: Possible diff to reproduce with ~10% failure rate:
Cmd:
./bld-cmake/test/functional/test_runner.py $(for i in {1..20}; do echo -n "p2p_orphan_handling.py ";done) -j $( nproc )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.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Base:
df0dc1e2d2059213e49a9f115fd55a9f0119d26cHead:
faf819bf23e8752644695e332cc00413d94af938I found no actionable issues in this static review.
Full review report
crACK
faf819bf23nit: the comment on
peer2.sync_with_ping()("Sync with the 'net' thread which completes the disconnection fully") is no longer correct given this PR update, since the ping doesn't guarantee peer1's deferred deletion has happened. The comment could be changed to something like "Sync with the 'net' thread and confirm peer2's messages have been processed".github.com/bitcoin/bitcoin@faf819bf23/test/functional/p2p_orphan_handling.py (L829)Can you please leave code review threads in the code tab. Otherwise, it is hard to follow the threads. Also, this comment doesn't seem right?
self.wait_until(lambda: len(node.getorphantxs(verbosity=2)[0]["from"]) == 1)establishes thatDisconnectedPeerhas been (or is being) called. Thus, the next ping will ensure the disconnect is fully handled and the code and comment is correct?Sure, I’ll leave code review threads in the Code tab going forward. On the nit, I interpreted the comment as referring to
sync_with_ping()synchronizing with the net thread afterDisconnectedPeerhas been invoked, rather than implying that the ping itself guarantees that the deferred deletion has already happened. Since the precedingwait_until(...)establishes thatDisconnectedPeerhas been called, the subsequent ping does ensure that the disconnect is fully handled, so I think the existing comment is still accurate.Also when writing comments in discussions, you can not use LLMs, per https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md
ACK
faf819bf23Backported to
32.xin #36727.ralph referenced this pull request2026-11-16 19:07:04 +00:00