Update default configuration for revoked HTLC clean-up (#3212)
What changed, and why it matters
This commit changes default settings and timing logic for a database cleanup task that removes old Lightning channel data after channels close. The old defaults deleted very large chunks very infrequently, which could slow down or stress busy nodes. The new defaults use smaller, more frequent deletions and avoid stacking up cleanup jobs when the database is already busy. There is no direct security vulnerability being patched; it is a performance and operational-stability improvement.
Treat as a routine performance/operational improvement rather than a security patch. Operators running busy Eclair nodes should review their local overrides for eclair.db.revoked-htlc-info-cleaner settings and consider adopting the new defaults to reduce IO spikes. No emergency upgrade is warranted for security reasons.
Security signals we found
Configuration change for background cleanup task
Timer logic change to prevent mailbox backlog under load
No cryptographic, authentication, or authorization changes
No input validation or parsing changes
Referenced issue #3211 and user-provided experiment data
Evidence from the diff
The patch updates RevokedHtlcInfoCleaner defaults in reference.conf from batch-size 50000/interval 15 minutes to batch-size 500/interval 1 second, and changes the actor timer from startTimerWithFixedDelay to startSingleTimer restarted after each batch. The goal is to prevent DeleteBatch messages from queuing in the mailbox when DB IO is slow, reducing memory pressure and performance degradation on nodes that close or splice channels frequently.
Changed components
eclair-core/src/main/resources/reference.confeclair-core/src/main/scala/fr/acinq/eclair/db/RevokedHtlcInfoCleaner.scalaInspect captured patch +7 / −3
diff --git a/eclair-core/src/main/resources/reference.conf b/eclair-core/src/main/resources/reference.conf
index 4d5634d..64f6c89 100644
--- a/eclair-core/src/main/resources/reference.conf
+++ b/eclair-core/src/main/resources/reference.conf
@@ -586,9 +586,10 @@ eclair {
// down the node, we delete those rows in batches at regular intervals.
revoked-htlc-info-cleaner {
// Number of rows to delete per batch: a higher value will clean up the DB faster, but may have a higher impact on performance.
- batch-size = 50000
+ batch-size = 500
// Frequency at which batches of rows are deleted: a lower value will clean up the DB faster, but may have a higher impact on performance.
- interval = 15 minutes
+ // If you are frequently closing or splicing channels, you may want to increase the default interval if you're seeing IO performance issues.
+ interval = 1 seconds
}
}
diff --git a/eclair-core/src/main/scala/fr/acinq/eclair/db/RevokedHtlcInfoCleaner.scala b/eclair-core/src/main/scala/fr/acinq/eclair/db/RevokedHtlcInfoCleaner.scala
index 98cc460..29acfd6 100644
--- a/eclair-core/src/main/scala/fr/acinq/eclair/db/RevokedHtlcInfoCleaner.scala
+++ b/eclair-core/src/main/scala/fr/acinq/eclair/db/RevokedHtlcInfoCleaner.scala
@@ -43,13 +43,16 @@ object RevokedHtlcInfoCleaner {
Behaviors.setup { context =>
context.system.eventStream ! EventStream.Subscribe(context.self)
Behaviors.withTimers { timers =>
- timers.startTimerWithFixedDelay(DeleteBatch, config.interval)
+ timers.startSingleTimer(DeleteBatch, config.interval)
Behaviors.receiveMessage {
case ForgetHtlcInfos(channelId, beforeCommitIndex) =>
db.markHtlcInfosForRemoval(channelId, beforeCommitIndex)
Behaviors.same
case DeleteBatch =>
db.removeHtlcInfos(config.batchSize)
+ // We restart a new timer after each batch, instead of using a timer at fixed intervals.
+ // This ensures that we don't have DeleteBatch messages queuing up in the mailbox when the DB is busy.
+ timers.startSingleTimer(DeleteBatch, config.interval)
Behaviors.same
}
}
Why this scored 28/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.