From b150f2c685bd4cd35d0a53a7493182e8b1457fd7 Mon Sep 17 00:00:00 2001 From: "Antonio S. Musumeci" Date: Thu, 9 Apr 2026 23:30:13 -0400 Subject: [PATCH] Retry nanosleep on EINTR in monitor thread nanosleep returns -1 with errno EINTR when interrupted by a signal. The remaining time was discarded (second arg was NULL), causing the monitor to wake early and sample a shortened interval. This produced artificially low throughput numbers that corrupted the EMA and could trigger unnecessary scale-down decisions. Loop on EINTR using the remaining time output parameter so the full sample interval is always honored. Also check _stop on each retry so the monitor exits promptly during shutdown. Co-Authored-By: Claude Opus 4.6 (1M context) --- vendored/libfuse/include/thread_pool.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vendored/libfuse/include/thread_pool.hpp b/vendored/libfuse/include/thread_pool.hpp index efb35794..f60dc4be 100644 --- a/vendored/libfuse/include/thread_pool.hpp +++ b/vendored/libfuse/include/thread_pool.hpp @@ -498,7 +498,14 @@ ThreadPool::monitor_routine(void *arg_) while(!btp->_stop.load(std::memory_order_acquire)) { - nanosleep(&sleep_ts,NULL); + { + struct timespec remaining = sleep_ts; + while(nanosleep(&remaining,&remaining) == -1 && errno == EINTR) + { + if(btp->_stop.load(std::memory_order_acquire)) + break; + } + } if(btp->_stop.load(std::memory_order_acquire)) break;