Repository navigation
Description
Found while reviewing #2789 (#2630).
The mid-stream pool-solvency re-check in both serve loops (crates/node/src/handlers/client/delivery.rs deliver, crates/node/src/handlers/client/serve_leg.rs) keeps serving a stream whose pool can no longer pay for it:
- Closed pool. Admission puts every admitted stream's pool in the projection, and
PoolProjection::forgetdrops it only onPoolReclaimed(crates/node/src/payment_settlement.rsfold) or when a re-anchor read finds itClosed. A latercached_statusthen returnsNone, and the re-check fails open. fix(node): count a skipped mid-stream pool re-check and test the serve-miss PoolExhausted stop #2789 counts this (decdn_serve_pool_recheck_skipped_total) and logs a throttledwarn!, but the stream continues.redeemManyrevertsPoolClosedon a closed pool (contracts/src/PaymentPool.solredeemMany), so the node is not paid for those bytes. On a serve miss it also keeps paying its upstream for them. - Forgotten signer.
ResolvingPoolView::signer_spent_cachedfalls back toprojection.signer_spent, which reads0for a pool the projection no longer holds, so the signer cap-headroom re-check also passes. - Closing pool past its dispute deadline. Neither loop reads
status.lifecycle. Admission refuses aClosingpool (dispatch.rs), but a stream admitted while the pool wasOpenkeeps running afterinitiateClose.redeemManyalso reverts whenClosing && block.timestamp >= disputeDeadline, and the redeemer drops lanes inside the landing slack.
Proposal: with a pool view wired, treat a None from cached_status and a Closing pool at or past disputeDeadline - REDEEM_LANDING_SLACK_SECS as a stop, in-band, like PoolExhausted. The exact reject reason and the counter it lands in are part of the design. With no pool view wired (dev/test), keep failing open.
Done when both loops stop such a stream in-band, a loopback test covers each case in each loop, and the ADR observability row for decdn_serve_pool_recheck_skipped_total is updated or the counter replaced.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
fix(node): stop a stream whose pool closes mid-stream (decdn#2812)