From 4d60ec50a1eea6dffc6993a2bd226826087bf7f3 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 4 Nov 2026 16:00:04 +0000 Subject: [PATCH] Expand on thread exited --- synapse/metrics/_thread_cpu.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/synapse/metrics/_thread_cpu.py b/synapse/metrics/_thread_cpu.py index d796411420..27cafd66d1 100644 --- a/synapse/metrics/_thread_cpu.py +++ b/synapse/metrics/_thread_cpu.py @@ -165,7 +165,13 @@ class ThreadCPUMetrics(Collector): with open(f"/proc/self/task/{tid}/stat") as f: line = f.read() except OSError: - # The thread exited since we listed it. + # The thread exited since we listed it. We lose this bit of + # CPU tracing, but it's hard to recover it after the thread + # has exited. + # + # We can see in the metrics how much thread CPU has been + # lost, by comparing total CPU vs. the sum of CPU used by + # all threads. continue # The thread name may contain spaces or brackets, so split after