From db5462b2bafed619ea06192f7203e8ba30829d7e Mon Sep 17 00:00:00 2001 From: SherlockShemol Date: Sat, 27 Dec 2025 06:50:19 +0000 Subject: [PATCH] fix: release graph_runtime_state reference to prevent memory leak Release the _graph_runtime_state reference in stop_listen() to allow Python GC to reclaim memory immediately after request completion. Without this fix, the reference chain: AppQueueManager._graph_runtime_state -> GraphRuntimeState -> Graph -> Node -> graph_runtime_state prevents garbage collection until the entire pipeline object is released, causing memory to accumulate under high concurrency. Fixes #30183 Signed-off-by: SherlockShemol --- api/core/app/apps/base_app_queue_manager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/api/core/app/apps/base_app_queue_manager.py b/api/core/app/apps/base_app_queue_manager.py index 698eee9894..b41bedbea4 100644 --- a/api/core/app/apps/base_app_queue_manager.py +++ b/api/core/app/apps/base_app_queue_manager.py @@ -90,6 +90,7 @@ class AppQueueManager: """ self._clear_task_belong_cache() self._q.put(None) + self._graph_runtime_state = None # Release reference to allow GC to reclaim memory def _clear_task_belong_cache(self) -> None: """