From 375f1f9303d0f60e795fa4e08183c73a99e8934c Mon Sep 17 00:00:00 2001 From: "Antonio S. Musumeci" Date: Fri, 10 Apr 2026 17:34:22 -0400 Subject: [PATCH] thread_pool: measure cooldown from completion in _maybe_grow_on_pressure The monitor stores _last_scale_time_usecs after _add_thread_scaling_locked returns (i.e. after pthread_create), but _maybe_grow_on_pressure stored a timestamp captured before the add. Under resource pressure pthread_create can take non-trivial time, making the effective cooldown shorter than configured on the fast-path grow. Move the store after _add_thread_scaling_locked and use a fresh _now_usecs() call, matching the monitor's behavior. Co-Authored-By: Claude Opus 4.6 (1M context) --- vendored/libfuse/include/thread_pool.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vendored/libfuse/include/thread_pool.hpp b/vendored/libfuse/include/thread_pool.hpp index 4df0304f..9b3b7339 100644 --- a/vendored/libfuse/include/thread_pool.hpp +++ b/vendored/libfuse/include/thread_pool.hpp @@ -806,9 +806,8 @@ ThreadPool::_maybe_grow_on_pressure() if(count >= _scaling_config.max_threads) return; - _last_scale_time_usecs.store(now,std::memory_order_relaxed); - _add_thread_scaling_locked({}); + _last_scale_time_usecs.store(_now_usecs(),std::memory_order_relaxed); syslog(LOG_DEBUG, "threadpool (%s): fast-path grow to %zu threads (queue full)", _name.c_str(),