Repository navigation
Description
Found while reviewing #1780.
Gap
FloorReservation::drop persists the pool's dead charge best-effort and swallows every failure into one un-metriced line (crates/node/src/handlers/client/mod.rs:494-505):
if let Err(e) = store.record_loss(pool_id, micro) {
tracing::warn!(%pool_id, error = %e, "floor dead-charge persist failed");
}The sibling path is instrumented — lane_flush_failure() at crates/node/src/runtime/mod.rs:521,525 behind decdn_lane_flush_failures_total (crates/node/src/metrics.rs:470-471). The floor-loss path has nothing: grep floor crates/node/src/metrics.rs returns seven hits, all unrelated (pricing floor, cache-miss floor, refundable floor).
Why it matters now
redb 4.2 (landed in #1778) adds, per its changelog: "Harden against errors and panics raised part way through WriteTransaction::commit(): the database now refuses further write transactions until it is closed and reopened."
lanes.redb is shared by the lane flush and the floor-loss table. So a single failed lane-flush commit latches the whole file, and every subsequent record_loss then fails at begin_write. The node silently stops persisting dead charges for the rest of the process lifetime, emitting one un-metriced warn! per reservation drop.
On restart, load_losses hydrates a stale row set and every pool that accrued dead charge since the latch gets a fresh free-floor budget — the exact re-grant the table exists to prevent. Nothing alerts.
Proposal
- Add a
floor_loss_persist_failurescounter besidelane_flush_failures, incremented at both call sites (mod.rs:496andmod.rs:502). - Surface
StorageError::Corrupteddistinctly from a transient. It currently flattens intoStoreError::Backend(String)alongside everything else, so "the payment database is corrupt" and "the disk was briefly busy" are indistinguishable at the call site. Either a dedicatedStoreErrorvariant or at minimumtracing::error!for the corrupt case. - Log
microin both warns — the amount that failed to reach disk currently appears in no error string and neither warn.
Per the metrics convention, this is one unlabeled counter per reason rather than a reason label. monitoring/ and the observability appendix are name-gated by tests in metrics.rs, so the new name needs adding there too.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
fix(node,payments): close the floor-loss error-path and in-memory res…