Repository navigation
fix(dash-spv): hedge in a task of its own - #1531
Conversation
A hedge waits for its write, up to 5 s when the peer stopped reading. The flow controller awaited it, so one slow write paused the rate and cap updates of every peer. Hedging now runs in its own task.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
✅ Review complete in 5m 8s Planner (3s) Review (behavior · full): 3 findings Judge (1m 24s) Posted: 2 findings Review metadataConfig:
Account limits:
Judge decisions:
A stalled write ends by disconnecting the peer, so the delay is bounded and every result stays correct. The trigger is left empty."
Timing:
|
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
There was a problem hiding this comment.
✅ Approved. 2 suggestions, none of which block.
What this does: Hedged requests, the duplicate requests sent to a second peer for work that holds up sync, used to run inside the bandwidth controller's loop. One slow write could stall bandwidth measurement for every peer.
What to test
The review model wrote these steps. Check what a step runs before you follow it.
Setup: Run a filter sync against several peers, ideally with one peer that is slow to accept writes, with peer_speed and dash_spv::network debug logging on.
- Run
cargo test -p dash-spv --lib a_hedge_waiting_for_its_write_holds_up_no_flow_tick. Expect it to pass. - Sync filters on testnet with several peers. Expect
peer_speedcap lines to keep appearing about every 500 ms whilehedged filter batchlines also appear. - Near the end of block download with an empty queue, watch the log. Expect
endgame: hedged blocklines as before. - Stop and restart the network manager. Expect no hedges sent after
stopand none to the peers of the nextstart. - Edge case: start the client with no peers configured or reachable. Expect no hedge log lines and no errors from the hedger task.
About this review
- Reviewed
4ecf2c4, round 1 - 89 changed lines read in 5m 8s
- Found by
claude-opus-5-5andgpt-6.2-sol, judged byclaude-opus-5-5 - Tokens: 2.7M in (2.0M from cache) · 40k out · about $3.62 at API prices
- Runner: self-hosted · started after 6s · peak memory 3.3 GiB of 30.0 GiB
- How Manki reviews
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1531 +/- ##
==========================================
- Coverage 87.62% 87.61% -0.01%
==========================================
Files 270 270
Lines 71695 71745 +50
==========================================
+ Hits 62821 62859 +38
- Misses 8874 8886 +12
|
The flow controller skipped its whole tick, hedges included, while no peer was connected. The hedger task lost that check when it was split out, so it scanned the request registry under its lock every 250 ms with nobody to send a copy to.
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
✅ Review complete in 7m 53s Planner (5s) Review (behavior · full): 4 findings Judge (2m 20s) Posted: 1 finding Review metadataConfig:
Account limits:
Judge decisions:
Timing:
Last reviewed
|
|
Bots are done — your move: post |
There was a problem hiding this comment.
✅ Approved.
Caution
Claude subscription has used 81% of its weekly limit, past the 80% mark. It resets 2026-12-01 05:00 UTC.
Once a limit is used up, reviews on that account stop until it resets.
What this does: Sending a backup copy of a stuck request to another peer could wait on a slow socket write and freeze the bandwidth controller meanwhile. That backup sending now runs in its own background task, so per-peer bandwidth caps keep updating while it waits.
What to test
The review model wrote these steps. Check what a step runs before you follow it.
Setup: Run the unit tests of dash-spv/src/network/manager.rs, or sync against testnet with filters enabled and peer_speed debug logging on.
- Run
cargo test -p dash-spv --lib a_hedge_waiting_for_its_write_holds_up_no_flow_tick. Expect it to pass without hanging. - Sync with filters enabled and watch the
peer_speedlogs. Expectcap=lines to keep appearing every half second whilehedged filter batchlines show up. - Let sync reach the tip of block download. Expect
endgame: hedged blockdebug lines only when the request queue is empty. - Disconnect all peers. Expect no hedging log lines while the peer set is empty.
- Call
stop()on the network manager. Expect the hedger task to exit with the other background tasks and no further hedge logs.
About this review
- Reviewed
674bd0d, round 2 - 92 changed lines read in 7m 53s
- Found by
claude-opus-5-5andgpt-6.2-sol, judged byclaude-opus-5-5 - Tokens: 2.7M in (2.1M from cache) · 38k out · about $3.32 at API prices
- Runner: self-hosted · started after 4m 30s · peak memory 1.9 GiB of 30.0 GiB
- How Manki reviews
…run 45798190730)
The flow controller sent the hedges itself, the second copies of a filter batch or block that holds up sync. Each one waits for its write, up to 5 s when the peer stopped reading or another write holds its writer, and meanwhile no peer's rate or cap was updated and no slow peer was flagged.
Hedging now runs in a task of its own on the same 250 ms tick, so a slow write no longer pauses the flow controller.
Split out of #1474.
PR Hygiene ·
674bd0d/self-reviewedWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.Summary by CodeRabbit