You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
node: download receipt log grows unbounded — no rotation, retention, or size cap #802
download_receipts.jsonl is an append-only log with one line written per accepted voucher interval (~one per MiB delivered, per the module docs). There is no rotation, truncation, retention window, or size cap anywhere in the module or its runtime wiring. On a long-running, high-throughput node the file grows monotonically for the entire process lifetime and across restarts (opened O_APPEND), eventually exhausting data_dir disk.
Evidence
crates/node/src/receipt_log.rs:231 (JsonlReceiptLog::open) — create(true).append(true), no size/age handling.
crates/node/src/receipt_log.rs:272 (append) — plain write_all + flush, no bound.
Runtime wiring in crates/node/src/runtime/mod.rs opens it once with no retention policy.
By contrast every other new stateful component in the same batch of work got explicit bounding (VoucherActivity eviction in feat(cli): add decdn node channels payment-channel snapshot (#749) #791, the session-ticket peer cap, the withdrawn_cache). The receipt log is the lone unbounded-growth sink with no follow-up referenced.
Suggested fix
Add size/age-based rotation (or a documented operator-driven truncation/retention policy) for the receipt log. Note this interacts with #803 — a full disk also back-pressures paid delivery today.
Filed during a repository review; verified not already tracked.
JsonlReceiptLog opens download_receipts.jsonl with O_APPEND and no rotation, truncation, or retention policy. On a sustained high-throughput node this file grows monotonically across restarts until data_dir runs out of disk. The reporter has pinpointed two specific code sites (receipt_log.rs:231 and receipt_log.rs:272) and notes the log is the only unbounded-growth sink added in this batch of work — every other stateful component received explicit eviction bounding. The closely related issue #803 surfaces the compounding risk: a full disk converts the "audit-only" write into an active delivery-stall via the awaited mutex flush on the voucher-accept hot path.
📊 Assessment
Dimension
Value
Reasoning
Type
Bug
Missing resource bound causes unbounded disk consumption — operational defect, not a feature gap
Labels are accurate; prod-blocking is correct given real disk-exhaustion risk on production nodes
Coding agent
Suitable
Requirements are concrete: add size- or age-based rotation (or a configurable retention window) to JsonlReceiptLog. Both the write path (receipt_log.rs:231, receipt_log.rs:272) and the runtime wiring (runtime/mod.rs) are identified. Success criterion is clear — log must not grow past a bounded limit regardless of uptime or throughput. Needs care around the shutdown/ordering invariants already noted in the in-code comment.
Size-based rotation (simplest, lowest risk): in JsonlReceiptLog::append, check file.metadata()?.len() after each flush and roll to a new timestamped file when it exceeds a configurable max_bytes (e.g., 512 MiB default). Keep N-1 rotated files (configurable keep_files).
Age-based rotation (alternative or combined): rotate once daily; keep last N days.
Config surface: expose [receipt_log] section in the operator config (in common/config schema) with max_bytes and keep_files — this avoids hard-coding operational policy and aligns with how VoucherActivity eviction is tuned.
Interaction with #803: Rotation alone does not decouple the write from the ack path. Address the two issues independently — #803 requires a channel/fire-and-forget decoupling regardless of whether rotation is in place.
Shutdown/ordering caveat: The existing in-code comment in client.rs:839 justifies awaiting for ordering guarantees on shutdown. Any rotation implementation must ensure the file handle swap is atomic from the perspective of that invariant (i.e., do not drop unwritten buffered data mid-rotation).
Sub-tasks checklist:
Add max_bytes / keep_files config fields to the ReceiptLogConfig (or create one if absent) in common
Implement size-based rotation in JsonlReceiptLog::open / append
Wire config into runtime/mod.rs open call
Unit-test: write past the cap, assert the old file is closed and a new one created, assert combined file count ≤ keep_files + 1
Activity
github-actions commentedon Jun 3, 2026
🎯 Triage report
JsonlReceiptLogopensdownload_receipts.jsonlwithO_APPENDand no rotation, truncation, or retention policy. On a sustained high-throughput node this file grows monotonically across restarts untildata_dirruns out of disk. The reporter has pinpointed two specific code sites (receipt_log.rs:231andreceipt_log.rs:272) and notes the log is the only unbounded-growth sink added in this batch of work — every other stateful component received explicit eviction bounding. The closely related issue #803 surfaces the compounding risk: a full disk converts the "audit-only" write into an active delivery-stall via the awaited mutex flush on the voucher-accept hot path.📊 Assessment
technical,high,rust,prod-blocking(all already applied)prod-blockingis correct given real disk-exhaustion risk on production nodesJsonlReceiptLog. Both the write path (receipt_log.rs:231,receipt_log.rs:272) and the runtime wiring (runtime/mod.rs) are identified. Success criterion is clear — log must not grow past a bounded limit regardless of uptime or throughput. Needs care around the shutdown/ordering invariants already noted in the in-code comment.🔗 Similar issues
💡 Notes and suggestions
Recommended implementation approach:
Size-based rotation (simplest, lowest risk): in
JsonlReceiptLog::append, checkfile.metadata()?.len()after each flush and roll to a new timestamped file when it exceeds a configurablemax_bytes(e.g., 512 MiB default). Keep N-1 rotated files (configurablekeep_files).Age-based rotation (alternative or combined): rotate once daily; keep last N days.
Config surface: expose
[receipt_log]section in the operator config (incommon/config schema) withmax_bytesandkeep_files— this avoids hard-coding operational policy and aligns with how VoucherActivity eviction is tuned.Interaction with #803: Rotation alone does not decouple the write from the ack path. Address the two issues independently — #803 requires a channel/fire-and-forget decoupling regardless of whether rotation is in place.
Shutdown/ordering caveat: The existing in-code comment in
client.rs:839justifies awaiting for ordering guarantees on shutdown. Any rotation implementation must ensure the file handle swap is atomic from the perspective of that invariant (i.e., do not drop unwritten buffered data mid-rotation).Sub-tasks checklist:
max_bytes/keep_filesconfig fields to theReceiptLogConfig(or create one if absent) incommonJsonlReceiptLog::open/appendruntime/mod.rsopen callkeep_files + 1Add this agentic workflows to your repo
To install this agentic workflow, run
feat(node): bound download-receipt log with size-based rotation (#802) (
feat(cli): surface receipt log path and rotation cap in config valida…