mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 12:20:38 +00:00
test: measure rpcwaittimeout floor with monotonic time #36529
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!36529
Loading…
Reference in a new issue
No description provided.
Delete branch "test-rpcwaittimeout-slack"
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?
Previously,
interface_bitcoin_cli.pymeasured the-rpcwaittimeoutwait floor withtime.time().bitcoin-cliarms that deadline withstd::chrono::steady_clock, so a CI wall-clock step backward can make the elapsed time look short and cause the assert to fail.Fix this by using
time.monotonic()instead and using-rpcwaittimeout=1. The log line also now says "at least" so it matches the floor assert.h/t ViniciusCestarii for suggesting
time.monotonic()here.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:
23288073d4e7723bf7559a904bbf322a52d8af55Head:
dc27539d42bbfc04705d9ae1ea00cf70b046d8faPrevious findings and author responses
Measure the timeout floor with a monotonic clock (test/functional/interface_bitcoin_cli.py:482, head)
This floor check uses time.time(), but bitcoin-cli computes and checks its timeout deadline with steady_clock. A wall-clock adjustment during the invocation can still skew the measured interval despite the 0.1-second slack. Use time.monotonic() for both samples, retaining any needed tolerance, and describe the timeout as elapsed/steady time rather than wall clock.
Previously reported. Status: fixed. Author position: rejected. Originally reported at
7445428eb851ab5314dab2cbe2dbe34fdd58200f. The earlier finding said the floor check usedtime.time()while bitcoin-cli enforces its deadline withsteady_clock. At the current head both samples usetime.monotonic(), and the assert checks the elapsed duration directly. The old 0.1s slack and its 'best effort wall clock' comment are gone. bitcoin-cli still sets and checks the deadline withsteady_clock, so the test and CLI now use the same kind of clock. Keeping no slack is correct here because the start sample comes before the subprocess launches. Author reply 2026-10-27T17:04:58ZReview tier: routine
Full review report
seems fine, but the 5 can probably be reduced to
1, to speed up the testUpdates:
lgtm ACK
7445428eb8cc @ViniciusCestarii
start_timeis taken before spawning bitcoin-cli and bitcoin-cli uses monotonic time, so the flake can only come from wall clock adjustment. Wouldn't replacingtime.time()withtime.monotonic()fix this without the slack?Good catch, not sure how I missed this. I presume I was confused by the LHS and RHS both doing addition. Maybe it would be clearer to understand and to read the assertion error message, when the LHS was
monotonic()-start_time, so that only the duration is printed. Steps to reproduce:Updates:
Addressed @ViniciusCestarii's feedback (use
time.monotonic())Addressed @maflcko's feedback (assert elapsed duration on the LHS)
lgtm ACK
dc27539d42ACK
dc27539d42