Use exponential backoff for outbound peer reconnection retries - #4107
Open
ayushsingh82 wants to merge 1 commit into
Open
Use exponential backoff for outbound peer reconnection retries#4107ayushsingh82 wants to merge 1 commit into
ayushsingh82 wants to merge 1 commit into
Conversation
PersistentConnection's dial loop retried on a fixed 1s delay, so a persistently offline peer got dialed (and logged at info level) once a second forever. It now backs off exponentially between 1s and 60s (matching the pattern already used in indexer/tee.rs), resetting back to the fast retry once a connection succeeds. Closes near#4063
Author
|
@netrome tagging you as the issue author — this is ready for review whenever you have time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PersistentConnection's dial loop incrates/node/src/p2p.rsretried on a fixed 1s delay, so a peer that's persistently offline gets dialed — and logged atinfolevel — once a second forever, spamming logs (and the network) while unrelated to any other issue.backon::ExponentialBuilder(1s min, 60s max, jittered, unbounded retries), matching the pattern already used incrates/node/src/indexer/tee.rs.retry_delayto the existing "could not connect, retrying" log line for visibility into the current backoff state.Closes #4063
Verification
cargo check -p mpc-node --all-features: cleancargo clippy -p mpc-node --all-targets --all-features -- -D warnings: clean (type-checks test code too)cargo fmt -- --check: cleancargo testlink+run locally (same disk constraint as Remove account_id parameter from IndexerViewClient methods #4102 — linkingmpc-node's test binary needs more disk than available here). The two existingPersistentConnectiontests (persistent_connection__should_keep_retrying_when_dial_attempt_hangs,persistent_connection__should_dial_new_address_after_resolver_update) use#[tokio::test(start_paused = true)], so tokio's virtual clock auto-advances throughsleeps regardless of duration — they only assert the loop keeps retrying/dialing, not on the fixed 1s timing, so the growing backoff delays shouldn't affect them. Happy to fix up anything CI's test run surfaces.Test plan
PersistentConnectionretry tests)