Skip to content

sync_service: bound AwaitingWarp wait with warp progress detection#3300

Open
lrubasze wants to merge 3 commits into
mainfrom
lrubasze/warp-stall-fallback
Open

sync_service: bound AwaitingWarp wait with warp progress detection#3300
lrubasze wants to merge 3 commits into
mainfrom
lrubasze/warp-stall-fallback

Conversation

@lrubasze

@lrubasze lrubasze commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves a TODO from #3268 (comment): a warp sync that stays alive but never completes kept queued subscribe_all requests waiting forever - the AwaitingWarp deadline re-armed as long as warp looked alive, and the starve/re-trigger cycle through Deciding reset the timer each round.

Changes

  • Track warp's verified finalized height (warp_sync_progress()), baselined on AwaitingWarp entry; each 30s deadline firing with progress re-arms the deadline.
  • One window without progress commits AllForksOnly: queued subscribers get the checkpoint header, like the other fallback paths. Committing is cheap - warp keeps running, and a later completion resets subscriptions at the warped head. A pending warp completion counts as progress so it is never discarded by the commit.
  • The AwaitingWarpDeciding starve fallback is removed; the stall commit covers that case.

Known edge: a warp that advances at least one fragment per window never triggers the fallback, so subscribers wait until it completes.

A warp sync that stays alive but never completes kept queued
subscribe_all requests waiting indefinitely (livelock re-arming the
deadline, or a starve/re-trigger cycle between Deciding and
AwaitingWarp). Track warp's verified finalized height across deadline
firings; after 3 windows without progress, commit AllForksOnly so
subscribers get the checkpoint header. Warp stays resumable, so a
later completion still reaches subscribers via Stop + resubscribe.

Resolves TODO from #3268 (discussion_r3319656011).
/// Deadline firings (`MODE_DECISION_TIMEOUT` apart) without warp progress before committing
/// AllForksOnly, so queued `SubscribeAll` requests always receive a response (the checkpoint
/// header).
const MODE_DECISION_MAX_WARP_STALLS: usize = 3;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Open question: how many stalled windows to wait before falling back?

Current draft waits 3 stalled windows (~90s). I'm considering 1 (~30s): a healthy warp normally shows progress within one window, and committing "too early" is cheap - subscribers get the checkpoint header, warp keeps running, and on completion they get Stop + resubscribe at the warped head anyway. It also removes the stall counter and the AwaitingWarpDeciding fallback entirely.

WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Went with 1 window. Committing early costs nothing: warp keeps running and its completion still resets subscriptions at the warped head. So waiting longer has no benefit. The stall counter and the fallback to Deciding are removed.

Small edge that remains: if warp makes some progress every window, we never commit and subscribers wait until warp finishes. If we ever want a hard cap on that wait, we can commit on the first deadline regardless of progress.

@lrubasze
lrubasze requested a review from a team July 7, 2026 14:41
A 30s window without warp progress now commits AllForksOnly directly,
dropping the 3-window stall counter and the AwaitingWarp -> Deciding
starve fallback. Committing early is cheap: warp stays unsuppressed and
a later completion still resets subscriptions at the warped head.

- keep the pending-completion check so a suppressed warp completion is
  never discarded by the commit
- baseline last_warp_progress on AwaitingWarp entry so the window
  measures warp activity after entry, not progress left over from
  Deciding
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.

1 participant