mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:50:37 +00:00
test: fix race in Tor control reconnect check #36937
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!36937
Loading…
Reference in a new issue
No description provided.
Delete branch "test/fix-torcontrol-reconnect-race"
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?
feature_torcontrol.pycan fail if the node reconnects before the test thread starts checking the backoff. This caused an intermittent CI failure on NetBSD even though the node observed the expected delay.Record when the mock Tor server accepts the new connection and compare that timestamp with the time just before triggering the disconnect. This preserves both checks: at least half a second must have elapsed, and the node must send
PROTOCOLINFO 1on reconnect.On Linux, the 1.5-second delay from the issue reproduced the original failure. The updated test passed both with and without that delay.
Fixes #36934.
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.Conflicts
Reviewers, this pull request conflicts with the following ones:
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.
🔵 Suggestion · The reconnect timing check includes work before the disconnect trigger
expect_disconnectincludes pre-trigger work in its 0.5-second check, so a slow test thread could mask a shortened reconnect backoff; this is a coverage improvement, not an observed false pass.Location:
test/functional/feature_torcontrol.py:153(head).Review coverage was incomplete.
Reviewed:
ba7734b12092· Review report · Previous reportspermalink
cACK
tACK
ba7734bReproduced #36934. On master,
ensure_forcheck fails immediately, and on this branch it passes.Also checked the new assertion still fails when the backoff is genuinely missing. Set
RECONNECT_TIMEOUT_STARTto 0.0 and rebuilding:Clearly, almost all of the 0.5s threshold has to come from the node's actual wait.
Ran
feature_torcontrol.py5 times on this branch with backoff restored, all passing.nit: this is the only
from time importundertest/functional. The other files useimport timewithtime.monotonic()Concept ACK
EDIT: and Approach ACK
There is no need to remove this comment since the line it refers to is unchanged.
Agree that this is a bit nicer but not a blocker
This comment seems to explain why the test was changed from the old version. But reading it after the change has been made is confusing. I would suggest to remove it.
I think this comment could be a bit clearer:
nit: I would have chosen 0.9s here
ACK
ba7734b120. code reviewed and testedtested with the reproducer patch (with a
4ssleep): the merge base failed atensure_for()as expected, while PRHEADpassed and correctly verified the reconnect behaviour and that at least 500ms had elapsed before the mock Tor server accepted the new connectionall the above was tested with
g++-12.5.0on NetBSD 11.0, targetingx86_64once the outstanding suggestions are accurately addressed, i believe this will be ok to merge because the patchset's core approach already asserts both the reconnection behaviour and the elapsed-time threshold correctly