Skip to content

Fix livelock in WaitUntilCaughtUpWith#411

Open
sisuresh wants to merge 1 commit into
stellar:mainfrom
sisuresh:fix-caughtup-moving-target
Open

Fix livelock in WaitUntilCaughtUpWith#411
sisuresh wants to merge 1 commit into
stellar:mainfrom
sisuresh:fix-caughtup-moving-target

Conversation

@sisuresh

Copy link
Copy Markdown
Contributor

The catchup gate from #410 compares against the reference peer's live ledger every poll. A watcher tracking the network at a constant offset (~8 ledgers behind while publishing checkpoints) never closes the gap, so MissionDatabaseInplaceUpgrade spins in the wait until the CI stage times out — observed in today's run:

[23:24:18 INF] Waiting until after-upgrade-0 (ledger 460) catches up with core-0 (ledger 468)
[23:24:41 INF] Waiting until after-upgrade-0 (ledger 482) catches up with core-0 (ledger 490)

Fix: snapshot the reference ledger once at wait entry and wait for the node to reach that fixed target. A trailing-but-tracking node passes in seconds; a genuinely stalled node (the original flake) still blocks until its next catchup round completes.

The gate from stellar#410 required the node to close to within 5 ledgers of the
reference peer's live ledger, re-reading both every poll. A watcher that
tracks the network at a constant offset (e.g. ~8 ledgers behind while also
publishing checkpoints) advances at network rate and never closes the gap,
so the wait spins until the CI stage times out.

Snapshot the reference peer's ledger once at wait entry and wait for the
node to reach that fixed target: a trailing-but-tracking node passes in
seconds, while a genuinely stalled node (the original flake) still blocks
until its next catchup round completes.
Copilot AI review requested due to automatic review settings July 17, 2026 23:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Snapshots the reference peer’s ledger to prevent catch-up waiting from livelocking against a moving target.

Changes:

  • Captures a fixed target ledger when waiting begins.
  • Updates polling and logging to use that target.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants