From 1d360cc2392a6128639d494b2490bae1e308746b Mon Sep 17 00:00:00 2001 From: cthomas Date: Wed, 7 Jan 2026 11:59:21 -0800 Subject: [PATCH] feat: dump thread state on event loop hang (#8388) --- letta/monitoring/event_loop_watchdog.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/letta/monitoring/event_loop_watchdog.py b/letta/monitoring/event_loop_watchdog.py index 2d707753..ac8bd015 100644 --- a/letta/monitoring/event_loop_watchdog.py +++ b/letta/monitoring/event_loop_watchdog.py @@ -139,7 +139,8 @@ class EventLoopWatchdog: # Only dump stack traces with 60s cooldown to avoid spam if (now - self._last_dump_time) > 60.0: - self._dump_asyncio_tasks() + self._dump_asyncio_tasks() # Dump async tasks + self._dump_state() # Dump thread stacks self._last_dump_time = now else: # Reset saturation tracking when recovered @@ -156,8 +157,8 @@ class EventLoopWatchdog: ) # Dump both thread state and asyncio tasks - self._dump_state() self._dump_asyncio_tasks() + self._dump_state() if consecutive_hangs >= 2: logger.critical(f"Event loop appears frozen ({consecutive_hangs} consecutive hangs), tasks={task_count}")