Repository navigation
fix(node): retry a transient eth_getLogs window inside the poller tick - #2163
Merged
Merged
Conversation
The shared chain-event poller failed the whole tick on the first non-range get_logs error. On a flaky provider that fed back on itself: a failed tick backs off, the backlog grows, the next tick needs more windows, and each window is another chance to fail. On the dRPC free plan every watcher showed minutes of downtime although no event was lost. A transient window failure now retries the same block range up to two times, 2 s apart, before the tick fails. A retry that succeeds fires no route hook. Range rejections keep the shrink path, and a permanent JSON-RPC error (is_permanent_rpc_error) still fails the tick at once. Each retry bumps the new decdn_chain_get_logs_retries_total counter, plotted beside the range rejections on the chain dashboard. Closes #2161 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Address the two review comments about metric semantics and alert wording.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR adds bounded, shutdown-aware retries for transient eth_getLogs failures and exposes retry observability.
Changes:
- Retries transient windows twice before failing a tick.
- Adds retry metrics, dashboard visibility, alert/runbook guidance, and ADR documentation.
- Adds classifier, shutdown, behavior, and metric wiring tests.
| File | Description |
|---|---|
monitoring/prometheus-alerts.yml |
Updates flapping alert guidance. |
monitoring/dashboard-chain.json |
Adds retry-rate visualization. |
docs/runbook.md |
Documents operational retry behavior. |
crates/node/src/runtime/mod.rs |
Wires the retry metric hook. |
crates/node/src/metrics.rs |
Defines and exports the retry counter. |
crates/node/src/chain_events/multiplexed_poller.rs |
Implements retry logic and tests. |
CHANGELOG.md |
Records the user-visible change. |
adr/appendix-observability.md |
Registers the retry metric. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…windows Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code Coverage OverviewLanguages: Rust Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit 33578cf in the Show a line coverage summary of the most impacted files.
Updated |
- Do not retry a rate limit in place (HTTP 429, Retry-After, or rate-limit wording): it goes straight to the loop's exponential backoff instead of spending more of an exhausted quota. - Log each retry and its cause at info, so an operator can tell a flaky provider from windows that are too wide without a debug restart. - Count a retry after its sleep, so a retry that shutdown cancels is not counted. - Say the counter counts retries (up to two per window), not windows, in the metric doc, ADR appendix, runbook and dashboard; point the flapping alert row and runbook bullet at it; note the 34 s worst case for a hung provider. - Fix stale and changelog-voice docs in multiplexed_poller.rs. - Tests: per-window retry budget across a multi-window tick, a later window that spends its retries keeps earlier progress, a retried window still shrinks on a range rejection, head-lag and rate-limit classifier cases, the retry delay is applied, and a rate limit is not retried. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

What
The shared chain-event poller failed the whole tick on the first non-range
eth_getLogserror. On the dRPC free plan (100-block cap, ~15–20 % of calls failing with code 19 / 30, ≥ 2 windows per 30 s tick) that fed back on itself: failed tick → backoff → bigger backlog → more windows → lower P(tick succeeds). Every watcher showed 3.5–12 mindown_secondspeaks although no event was lost.run_ticknow fetches each window throughfetch_window_logs, which retries a transient failure on the same block range up to 2 times, 2 s apart, before the tick fails:on_backoff, no restart count, nodown_sincechange.is_permanent_rpc_error: revert, invalid request/method/params, HTTP 4xx other than 408/429) and a rate limit (is_rate_limit: HTTP 429,Retry-After, rate-limit wording) fail the tick at once, so a used-up quota gets the loop's exponential backoff, not fixed 2 s retries.info, so an operator can tell a flaky provider from windows that are too wide (timeouts).on_window_retryhook →decdn_chain_get_logs_retries_total, added toappendix-observability, the "eth_getLogs window span" dashboard panel, the flapping-alert description and the runbook.Closes #2161
Reviewer notes
fetch_window_logsandis_transient_window_errorincrates/node/src/chain_events/multiplexed_poller.rsfirst. The helper takes the poller's parts instead of&MultiplexedPollerbecause the poller is notSync.GET_LOGS_WINDOW_RETRIES,GET_LOGS_WINDOW_RETRY_DELAY), not config knobs.a_rate_limit_backs_off_and_keeps_the_windownow also asserts that no retry happens (a queued success would otherwise complete the tick).down_secondssemantics.Verification
cargo fmt -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo nextest run -p decdn-node— 1354 passed. New tests cover: retry then success (delay applied); exhausted retries; per-window budget across a multi-window tick; a later exhausted window keeps earlier progress; retry then range rejection still shrinks; permanent error and rate limit not retried; shutdown during the retry sleep; classifier cases (dRPC 19/30, head lag, timeouts, 401, 429, Retry-After). Mutations: retries = 0 fails 6 tests; dropping the rate-limit exclusion fails 1.RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-itemspre-commit runon the changed filescontracts/changed — n/aCHANGELOG.mdentry addedadr/appendix-observability.mdmetric row addedPost-deploy check on testnet:
decdn_*_watcher_down_secondspeaks drop,multiplexed poller tick errorlines fall, andrate(decdn_chain_get_logs_retries_total)takes over as the flakiness signal.🤖 Generated with Claude Code