Skip to content

chore: log peer count in WaitForSync to diagnose sync flakes#7149

Open
rootulp wants to merge 3 commits intomainfrom
rootulp/log-peer-count-wait-for-sync
Open

chore: log peer count in WaitForSync to diagnose sync flakes#7149
rootulp wants to merge 3 commits intomainfrom
rootulp/log-peer-count-wait-for-sync

Conversation

@rootulp
Copy link
Copy Markdown
Collaborator

@rootulp rootulp commented Apr 20, 2026

Summary

  • Widens WaitForSync's client parameter from rpcclient.StatusClient to rpcclient.Client so NetInfo() can be called alongside Status().
  • The per-tick log line now includes Peers=N alongside Height and CatchingUp.
  • If NetInfo returns an error, the log line omits Peers and includes the error instead; polling continues either way.

Why

TestSyncToTipMocha intermittently fails either because block sync doesn't finish inside the 10m KPI window (#7138) or because Chain.Start() can't dial any mocha peer (#7147). In both modes, the current log line (Height=X, CatchingUp=Y) doesn't tell us whether the node actually has peers to sync from. Logging NumPeers on each tick will let us distinguish "slow peer" from "no peers" the next time this flakes, without having to reproduce the failure locally.

This is diagnostic — it doesn't resolve #7138 by itself, but it makes the next failure actionable.

Test plan

  • go vet ./... passes in test/docker-e2e
  • go test -count=0 ./... (compile-only) passes in test/docker-e2e
  • make build succeeds
  • Next nightly run includes Peers=N in log output

Related

Refs #7138


Open in Devin Review

Widens WaitForSync's client parameter from rpcclient.StatusClient to
rpcclient.Client so NetInfo() can be called alongside Status(). The
per-tick log line now includes Peers=N to make it easier to correlate
sync throughput with peer connectivity when TestSyncToTipMocha fails on
mocha. NetInfo errors are tolerated (logged as Peers=-1).

Refs #7138
@rootulp rootulp requested a review from a team as a code owner April 20, 2026 18:44
@rootulp rootulp requested review from evan-forbes and removed request for a team April 20, 2026 18:44
@rootulp rootulp self-assigned this Apr 20, 2026
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@rootulp rootulp enabled auto-merge April 20, 2026 18:44
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@rootulp rootulp requested a review from ninabarbakadze April 20, 2026 18:58
Comment thread test/docker-e2e/e2e_test.go
@rootulp rootulp marked this pull request as draft April 21, 2026 22:31
auto-merge was automatically disabled April 21, 2026 22:31

Pull request was converted to draft

rootulp and others added 2 commits April 21, 2026 15:32
Address review feedback from @cmwaters: replace the `-1` peer sentinel with two
distinct log lines so a NetInfo error is obvious in test output instead of
cryptic.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rootulp rootulp requested a review from cmwaters April 21, 2026 22:39
@rootulp rootulp marked this pull request as ready for review April 21, 2026 22:39
@rootulp rootulp enabled auto-merge April 21, 2026 22:40
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: TestSyncToTipMocha nightly flake — block sync exceeds 10m KPI window

2 participants