From 1539463f53b1b48f1b234c62949996122c65bbea Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 28 Apr 2026 20:04:49 +0200 Subject: [PATCH 1/3] fix(cache): reduce tx cache retention --- block/internal/cache/manager.go | 3 ++- block/internal/reaping/reaper.go | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/block/internal/cache/manager.go b/block/internal/cache/manager.go index e907002600..4a8e7622ad 100644 --- a/block/internal/cache/manager.go +++ b/block/internal/cache/manager.go @@ -26,7 +26,8 @@ const ( DataDAIncludedPrefix = "cache/data-da-included/" // DefaultTxCacheRetention is the default time to keep transaction hashes in cache. - DefaultTxCacheRetention = 24 * time.Hour + // Keeping a too high value can lead to OOM during heavy transaction load. + DefaultTxCacheRetention = 45 * time.Second ) // CacheManager provides thread-safe cache operations for tracking seen blocks diff --git a/block/internal/reaping/reaper.go b/block/internal/reaping/reaper.go index d35dbfff3e..d35c61e422 100644 --- a/block/internal/reaping/reaper.go +++ b/block/internal/reaping/reaper.go @@ -21,7 +21,10 @@ import ( const ( // MaxBackoffInterval is the maximum backoff interval for retries MaxBackoffInterval = 30 * time.Second - CleanupInterval = 1 * time.Hour + + // CleanupInterval is how often the reaper sweeps expired hashes + // out of the seen-tx cache. + CleanupInterval = max(cache.DefaultTxCacheRetention/10, 5*time.Second) ) // Reaper is responsible for periodically retrieving transactions from the executor, From 388cbd1d37f29fd16bbb71c6fef67c36fba0233c Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 28 Apr 2026 20:07:00 +0200 Subject: [PATCH 2/3] fixes --- block/internal/cache/manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/internal/cache/manager.go b/block/internal/cache/manager.go index 4a8e7622ad..4d95a7d7e5 100644 --- a/block/internal/cache/manager.go +++ b/block/internal/cache/manager.go @@ -27,7 +27,7 @@ const ( // DefaultTxCacheRetention is the default time to keep transaction hashes in cache. // Keeping a too high value can lead to OOM during heavy transaction load. - DefaultTxCacheRetention = 45 * time.Second + DefaultTxCacheRetention = 30 * time.Minute ) // CacheManager provides thread-safe cache operations for tracking seen blocks From 031123108fc95ed3a7c069563832bc6b32e7626e Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 28 Apr 2026 20:07:59 +0200 Subject: [PATCH 3/3] cl --- CHANGELOG.md | 1 + block/internal/reaping/reaper.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0097fb829b..a5388cc089 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changes - Optimization of mutex usage in cache for reaper [#3286](https://github.com/evstack/ev-node/pull/3286) +- Reduce tx cache retention to avoid OOM under (really) heavy tx load [#3299](https://github.com/evstack/ev-node/pull/3299) ## v1.1.1 diff --git a/block/internal/reaping/reaper.go b/block/internal/reaping/reaper.go index d35c61e422..1f51c08f10 100644 --- a/block/internal/reaping/reaper.go +++ b/block/internal/reaping/reaper.go @@ -24,7 +24,7 @@ const ( // CleanupInterval is how often the reaper sweeps expired hashes // out of the seen-tx cache. - CleanupInterval = max(cache.DefaultTxCacheRetention/10, 5*time.Second) + CleanupInterval = max(cache.DefaultTxCacheRetention/10, 15*time.Second) ) // Reaper is responsible for periodically retrieving transactions from the executor,