Repository navigation
fix(node): give an admit getPool fault a short negative-cache window - #2322
Merged
Merged
Conversation
The admit-path negative cache held a pool for the full 60 s whether getPool answered "absent/closed" or merely failed or timed out. One slow read on a live, solvent pool refused every request on it for a minute, and the cache-hit path logged nothing. Each entry records why it exists. A verdict keeps RESOLVE_VERDICT_TTL (60 s); a fault uses RESOLVE_FAULT_TTL (5 s), so a live pool is admitted again soon after the RPC recovers. A cache hit logs its reason at debug. Admit getPool reads are coalesced per pool: a request that finds a read in flight waits for it and re-checks the projection and the negative cache, and a cancelled reader hands the read to a waiter. Without this a fault window shorter than the 10 s read bound would let every request during a hung-RPC outage wait out a read of its own. The negative cache skips an insert when it is still full after the prune, so it no longer grows past RESOLVE_NEGATIVE_CACHE_MAX. Closes #2318 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
A full negative cache causes coalesced waiters to repeat completed reads serially because no result is retained.
Review effort: Balanced
Findings: 1
What changed in this PR
Splits getPool negative-cache windows by failure reason and coalesces concurrent pool reads.
Changes:
- Uses 60-second verdict and 5-second fault TTLs.
- Adds per-pool read coalescing and cache-hit diagnostics.
- Expands tests for expiry, capacity, concurrency, and cancellation.
| File | Description |
|---|---|
crates/node/src/payment_settlement.rs |
Implements reason-aware caching, coalescing, and tests. |
crates/node/src/chain_events/mod.rs |
Adds counted hanging-provider test support. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: Rust Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit 1b84cc1 in the Show a line coverage summary of the most impacted files.
Updated |
Waiters re-derived the read's outcome from the projection and the negative cache. When the cache was full of in-window entries the read's negative was not recorded, so each waiter found nothing, started a read of its own, and N concurrent requests ran N reads in turn. The reader now sends its answer on the in-flight channel before it ends the read, and a waiter returns it. A read that ends unanswered was cancelled, so a waiter re-checks and takes it over. 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.

Summary
Closes #2318.
The admit-path
getPoolnegative cache inResolvingPoolView::statusheld a pool for the full 60 s whethergetPoolanswered "absent/closed" or merely failed / timed out. One slow read on a live, solvent pool refused every request on that pool for a minute, and the cache-hit path logged nothing.NegativeReason: aVerdict(absent /Closed) keepsRESOLVE_VERDICT_TTL(60 s, renamed fromRESOLVE_NEGATIVE_TTL); aFault(RPC error ortimedtimeout) usesRESOLVE_FAULT_TTL(5 s). The cap-prune applies each entry's own window.getPool. Reads are now coalesced per pool (ReadSlot/InflightRead, awatchchannel that closes when the read's guard drops): waiters re-check the projection and the negative cache the reader wrote, and a cancelled reader hands the read to a waiter.debug; the fault WARN'ssuppressed_fornames the 5 s window (its fix(node): bound admit-path chain reads and keep the RPC failure class in logs #2278 log test now assertssuppressed_for=5s).remember_negativeskips an insert when the cache is still full after the prune, matchingAUTH_CACHE_MAX; previously the map could grow pastRESOLVE_NEGATIVE_CACHE_MAX.Not in scope: a separate fault-refusal counter (the issue's optional item).
PoolView::statusreturnsOption<PoolStatus>, so the handler cannot tell why it gotNone; splitting the counter needs a trait change.Test plan
cargo nextest run -p decdn-node— 1597 passedcargo clippy --workspace --all-targets --all-features -- -D warnings,cargo fmt -- --check,RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-itemsClosedrecordVerdictand suppress past the fault window; RPC error recordsFault; fresh fault suppresses the re-read; faulted live pool admitted after the RPC recovers; 8 concurrent requests → 1getPool; waiter takes over a cancelled read🤖 Generated with Claude Code