From ebc1534856218136d750e5b97ba54639ee0303b1 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Wed, 22 Oct 2025 14:47:34 +0200 Subject: [PATCH] feat: warning log when blocked on execution cache --- .../tree/src/tree/payload_processor/mod.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/crates/engine/tree/src/tree/payload_processor/mod.rs b/crates/engine/tree/src/tree/payload_processor/mod.rs index cdac92ed675..8ab186dea5b 100644 --- a/crates/engine/tree/src/tree/payload_processor/mod.rs +++ b/crates/engine/tree/src/tree/payload_processor/mod.rs @@ -40,10 +40,13 @@ use reth_trie_sparse::{ ClearedSparseStateTrie, SparseStateTrie, SparseTrie, }; use reth_trie_sparse_parallel::{ParallelSparseTrie, ParallelismThresholds}; -use std::sync::{ - atomic::AtomicBool, - mpsc::{self, channel, Sender}, - Arc, +use std::{ + sync::{ + atomic::AtomicBool, + mpsc::{self, channel, Sender}, + Arc, + }, + time::Instant, }; use tracing::{debug, debug_span, instrument, warn}; @@ -596,8 +599,16 @@ impl ExecutionCache { /// A cache is considered available when: /// - It exists and matches the requested parent hash /// - No other tasks are currently using it (checked via Arc reference count) + #[instrument(level = "debug", target = "engine::tree::payload_processor", skip(self))] pub(crate) fn get_cache_for(&self, parent_hash: B256) -> Option { + let start = Instant::now(); let cache = self.inner.read(); + + let elapsed = start.elapsed(); + if elapsed.as_millis() > 5 { + warn!(blocked_for=?elapsed, "Blocked waiting for execution cache mutex"); + } + cache .as_ref() .filter(|c| c.executed_block_hash() == parent_hash && c.is_available())