Repository navigation
fix(dash-spv): quiet idle and per-tick network logs - #1334
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 19 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
789d64d to
351f2e6
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1334 +/- ##
==========================================
+ Coverage 85.17% 85.26% +0.09%
==========================================
Files 268 268
Lines 68101 68673 +572
==========================================
+ Hits 58005 58555 +550
- Misses 10096 10118 +22
|
The flow controller printed one line per peer plus a `bandwidth:` line every 500 ms even while nothing moved, which made up most of a synced client's debug output. A peer line now prints only when the peer's bytes read, bytes in flight or cap changed since its last line, and the `bandwidth:` line only when a peer line printed or the global totals changed. The line format is unchanged.
`state` and `is_synced` built the same list of manager states. Both now use one private `manager_states` helper.
The progress monitor logged the full 10 line `SyncProgress` dump at `info` on every update, about 24 times a second during sync. It now logs a value when any manager changes state, and otherwise at most once every 5 seconds. A state change is never delayed, so each phase start and finish and the final synced state are still logged when they happen. Handlers still receive every update.
Every connection close logged `NETWORK: peer X disconnected` from the reader and `peer disconnected: X | N peers remaining | M re-queued` from the pump, both at `info`, even for a probed peer the supervisor dropped without it ever joining the set. In the log that read like peer churn. The reader no longer logs the close, since it cannot tell whether its peer is in the set. The pump logs the existing `info` line when the close removed a member, and a single `debug` line otherwise. A member that the supervisor swapped out or the timeout monitor kicked is already gone from the set by then, and its removal is still logged by whoever removed it.
Each network event was logged once at `info` by the event monitor and again at `debug` by each of the 8 sync managers. The per-manager copy is now at `trace`, so a `debug` log shows each event once.
The CFHeaders and blocks pipelines re-declare every wanted request on each 100 ms tick, which is safe because the broker de-duplicates, but each pass logged `Declared N wanted ...` again while the same request was still in flight. Both pipelines now remember whether a request was added since the last declare, and log the line only then.
`take_ready_to_store` returned and logged the segment's start height for every batch it drained, so after the first batch of a segment the `Segment N: M headers ready to store from height H` line named the wrong height, such as 1579670 while storing near 1585910. The start is now derived from `current_height` and the drained count. That left the `SegmentState::start_height` field unread, so it is removed.
351f2e6 to
294220e
Compare
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
Bots are done — your move: post |
`stop` empties the peer set before the readers report their closed connections, so the pump logs those closes at `debug` as connections outside the set. The removal is now logged by `stop` itself: `PeerSet::clear` returns the addresses it removed, and `stop` logs them at `info`. With this, every path that takes a member out of the set logs it at `info` or `warn`: the pump for a remote disconnect, the supervisor for a swap, the timeout monitor for a kick, and `stop`. A remote disconnect of a member now logs one `info` line instead of two, since the reader no longer logs the close.
The header pipeline re-declares each active segment's `GetHeaders` on every 100 ms tick, which is safe because the broker de-duplicates. Each pass logged `Segment N: declared GetHeaders from height H hash X` again for the same height until the reply arrived, about half of a fresh testnet sync log, and `send_pending` counted every re-declare, so `Tick: pipeline sent N more requests` repeated as well. Each segment now remembers the locator it last declared. `send_request` logs and reports a request as new only when the locator differs, and a reply, empty or not, makes the next request new again. A resumed sync forgets the declared locators, since its queued requests may have been dropped. `send_pending` returns the number of new requests, so the tick line and the start line only report those, now worded as `declared N new request(s)`.
`underserving_peer` runs on every flow tick, so its "replacement is worth probing for" line repeated every 250 ms while a peer stayed slow. It now returns the slow peer with both rates, and the flow controller logs it only on the transition that wakes the supervisor.
beb7b30 to
b185a2f
Compare
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
Bots are done — your move: post |
|
/self-reviewed |
|
Policy satisfied — this can merge. |
Closes #1331.
Problem
A 23 minute testnet run (a full filter rescan, then 22 minutes idle at the tip) produced 81k log lines at
debug, most of them without information:peer_speedreport was over 90% of all output: one line per peer plus abandwidth:line every 500 ms, each readingin_flight=0 KB rate=0.00 MB/s.SyncProgressdump was logged atinfoabout 24 times a second.infodisconnect lines for a peer that never joined the set. In the log that read like peer churn.X serving at ... a replacement is worth probing forrepeated on every 250 ms flow tick while a peer stayed slow, 7 times in 1.5 s.Declared 1 wanted ... to the brokerrepeated on every tick until the reply arrived, for CFHeaders and for blocks, andSegment N: declared GetHeaders ...did the same for headers.One progress value was also wrong:
Segment 0: 1 headers ready to store from height 1579670with the tip at 1,585,910. The other one in #1331, a restored headers target below the stored tip, changes persisted state rather than a log line and is fixed separately in #1353.Fix
One commit per item:
peer_speedonly on change. A peer line prints only when its bytes read, bytes in flight or cap changed since its last line. Thebandwidth:line prints when a peer line printed or the global numbers changed. Same level and format, and thecli-benchtooling does not depend on the cadence. After a burst the last printed rate can stay non-zero, because the decaying moving average is no longer printed.SyncProgressrate limit. A dump is logged whenever any manager changes state, otherwise at most once every 5 s. A state change is never delayed, so each phase start and finish and the final synced state are logged when they happen, which the benchmark reports rely on. Handlers still receive every update. Arefactorcommit first shares the manager state list betweenstate()andis_synced().debugline. The reader cannot tell whether its peer is in the set, so itsNETWORK: peer X disconnectedline is gone. The pump logs the existinginfoline when the close removed a set member, and adebugline otherwise. A remote disconnect of a member now logs oneinfoline instead of two. A peer removed by a swap or a timeout kick is logged where it is removed.stopnow names the peers it disconnects (network manager stopping: disconnected N peer(s) [..]), since its existing line named none. So every path that removes a set member logs it atinfoorwarn.trace. The single event handler line stays.underserving_peerreturns the peer with its rate and the best rate, and the flow controller logs the line only on the transition that also wakes the supervisor. The log text is unchanged.Segment N: declared GetHeaders ...only for a new one. The request still goes to the broker every tick, so routing is unchanged. A reply clears the remembered locator, so a real re-request after the tip reopens is still logged, and a resumedstart_syncforgets them all sincestopclears the broker. TheTick: pipeline ...count lines now count new requests only. In a fresh testnet sync these two lines were 75k of 128k log lines.SegmentState::start_heightfield is removed.Tests
test_completed_tip_accepts_unsolicited_header_batchis extended with a second batch, which must report start 1003. The old code reported 1001.test_draining_active_window_exposes_next_segment_for_refillandtest_pipeline_send_pendingcheck that a re-declare counts as nothing new, and that the same locator counts as new again after a reply reopens the tip.cargo test -p dash-spv --lib: 639 passed (ondevat4e49ea925).just dash-spv::test: all green, including dashd_sync 38/38 and dashd_masternode 11/11.PR Hygiene ·
b185a2fWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.