From 28647966e2e085f7c1a8514faafe1f82df99fb5a Mon Sep 17 00:00:00 2001 From: Nitzan Mordechai Date: Wed, 27 May 2026 11:48:14 +0000 Subject: [PATCH] mgr/ThreadMonitor: monitor interval running in seconds and not nanoseconds The ctor accidently use the mgr_module_monitor_interval as nanoseconds we need to use it as seconds. Also, prevent high cpu loop in case read_process_statm failed during while loop Fixes: https://tracker.ceph.com/issues/76938 Signed-off-by: Nitzan Mordechai --- src/mgr/ThreadMonitor.cc | 1 + src/mgr/ThreadMonitor.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mgr/ThreadMonitor.cc b/src/mgr/ThreadMonitor.cc index d26a747ed6ec..46f86f6e8943 100644 --- a/src/mgr/ThreadMonitor.cc +++ b/src/mgr/ThreadMonitor.cc @@ -88,6 +88,7 @@ void ThreadMonitor::monitoring_loop() { long long process_rss_pages = 0; if (!read_process_statm(process_rss_pages)) { derr << "Failed to read process memory info from /proc/self/statm." << dendl; + std::this_thread::sleep_for(monitoring_interval); continue; } diff --git a/src/mgr/ThreadMonitor.h b/src/mgr/ThreadMonitor.h index 60a839ae9655..fe09fd73fd0f 100644 --- a/src/mgr/ThreadMonitor.h +++ b/src/mgr/ThreadMonitor.h @@ -21,7 +21,7 @@ public: ThreadMonitor(CephContext *cct) : m_cct(cct), running(false), - monitoring_interval(m_cct->_conf.get_val("mgr_module_monitor_interval")) + monitoring_interval(std::chrono::seconds(m_cct->_conf.get_val("mgr_module_monitor_interval"))) { m_cct->_conf.add_observer(this); m_clock_ticks_per_sec = sysconf(_SC_CLK_TCK); -- 2.47.3