Yuxi-Know icon indicating copy to clipboard operation
Yuxi-Know copied to clipboard

Error: langgraph 的 SQLite 异步 Checkpoint 模块持续触发 is_alive() 错误

Open wzb83889 opened this issue 1 month ago • 1 comments

1️⃣ 描述一下问题

部署V3.0版本正常,但是升级到V3.5代码重新构建镜像容器后,再次访问提问显示Error streaming messages: 'Connection' object has no attribute 'is_alive', Traceback (most recent call last)

2️⃣ 报错日志

请运行以下命令,并提供部分相关日志:

# macOS / Linux
make logs

# Windows
docker logs --tail=100 api-dev
git rev-parse HEAD
make logs 的输出:

PS C:\Users\SXB> docker logs --tail=100 api-dev
12-23 21:11:51 INFO: 127.0.0.1:59098 - "GET /api/system/health HTTP/1.1" 200
12-23 21:12:21 INFO: 127.0.0.1:43764 - "GET /api/system/health HTTP/1.1" 200
12-23 21:12:51 INFO: 127.0.0.1:45750 - "GET /api/system/health HTTP/1.1" 200
12-23 21:13:21 INFO: 127.0.0.1:46124 - "GET /api/system/health HTTP/1.1" 200
12-23 21:13:51 INFO: 127.0.0.1:41292 - "GET /api/system/health HTTP/1.1" 200
12-23 21:14:21 INFO: 127.0.0.1:60122 - "GET /api/system/health HTTP/1.1" 200
12-23 21:14:52 INFO: 127.0.0.1:55896 - "GET /api/system/health HTTP/1.1" 200
12-23 21:15:22 INFO: 127.0.0.1:52530 - "GET /api/system/health HTTP/1.1" 200
12-23 21:15:52 INFO: 127.0.0.1:37290 - "GET /api/system/health HTTP/1.1" 200
12-23 21:16:22 INFO: 127.0.0.1:56666 - "GET /api/system/health HTTP/1.1" 200
12-23 21:16:52 INFO: 127.0.0.1:41824 - "GET /api/system/health HTTP/1.1" 200
12-23 21:17:22 INFO: 127.0.0.1:53728 - "GET /api/system/health HTTP/1.1" 200
12-23 21:17:52 INFO: 127.0.0.1:54800 - "GET /api/system/health HTTP/1.1" 200
12-23 21:18:23 INFO: 127.0.0.1:35132 - "GET /api/system/health HTTP/1.1" 200
12-23 21:18:53 INFO: 127.0.0.1:46476 - "GET /api/system/health HTTP/1.1" 200
12-23 21:19:23 INFO: 127.0.0.1:45910 - "GET /api/system/health HTTP/1.1" 200
12-23 21:19:53 INFO: 127.0.0.1:45350 - "GET /api/system/health HTTP/1.1" 200
12-23 21:20:23 INFO: 127.0.0.1:54142 - "GET /api/system/health HTTP/1.1" 200
12-23 21:20:53 INFO: 127.0.0.1:46172 - "GET /api/system/health HTTP/1.1" 200
12-23 21:21:23 INFO: 127.0.0.1:49094 - "GET /api/system/health HTTP/1.1" 200
12-23 21:21:53 INFO: 127.0.0.1:53752 - "GET /api/system/health HTTP/1.1" 200
12-23 21:22:23 INFO: 127.0.0.1:56698 - "GET /api/system/health HTTP/1.1" 200
12-23 21:22:53 INFO: 127.0.0.1:40630 - "GET /api/system/health HTTP/1.1" 200
12-23 21:23:24 INFO: 127.0.0.1:48160 - "GET /api/system/health HTTP/1.1" 200
12-23 21:23:54 INFO: 127.0.0.1:35558 - "GET /api/system/health HTTP/1.1" 200
12-23 21:24:24 INFO: 127.0.0.1:58310 - "GET /api/system/health HTTP/1.1" 200
12-23 21:24:54 INFO: 127.0.0.1:40402 - "GET /api/system/health HTTP/1.1" 200
12-23 21:25:24 INFO: 127.0.0.1:39782 - "GET /api/system/health HTTP/1.1" 200
12-23 21:25:54 INFO: 127.0.0.1:51406 - "GET /api/system/health HTTP/1.1" 200
12-23 21:26:07 INFO chat_router.py:329: agent_id: ChatbotAgent, query: 你好, config: {'thread_id': '6dfac0c5-f9c3-43a6-87a9-8f9821265503'}, meta: {}
12-23 21:26:07 INFO: 172.18.0.7:56136 - "POST /api/chat/agent/ChatbotAgent HTTP/1.1" 200
12-23 21:26:07 DEBUG manager.py:123: Added user message to conversation 1
12-23 21:26:07 DEBUG base.py:62: stream_messages: Context(thread_id='6dfac0c5-f9c3-43a6-87a9-8f9821265503', user_id='1', system_prompt='You are a helpful assistant.', model='siliconflow/Qwen/Qwen3-235B-A22B-Instruct-2507', tools=[], mcps=[])
12-23 21:26:07 ERROR chat_router.py:471: Error streaming messages: 'Connection' object has no attribute 'is_alive', Traceback (most recent call last):
  File "/app/server/routers/chat_router.py", line 398, in stream_messages
    async for msg, metadata in agent.stream_messages(messages, input_context=input_context):
  File "/app/src/agents/common/base.py", line 65, in stream_messages
    async for msg, metadata in graph.astream(
  File "/app/.venv/lib/python3.12/site-packages/langgraph/pregel/main.py", line 2888, in astream
    async with AsyncPregelLoop(
               ^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/langgraph/pregel/_loop.py", line 1264, in __aenter__
    saved = await self.checkpointer.aget_tuple(self.checkpoint_config)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/langgraph/checkpoint/sqlite/aio.py", line 330, in aget_tuple
    await self.setup()
  File "/app/.venv/lib/python3.12/site-packages/langgraph/checkpoint/sqlite/aio.py", line 284, in setup
    if not self.conn.is_alive():
           ^^^^^^^^^^^^^^^^^^
AttributeError: 'Connection' object has no attribute 'is_alive'

12-23 21:26:07 ERROR chat_router.py:271: Error checking for interrupts: 'Connection' object has no attribute 'is_alive'
12-23 21:26:07 ERROR chat_router.py:272: Traceback (most recent call last):
  File "/app/server/routers/chat_router.py", line 398, in stream_messages
    async for msg, metadata in agent.stream_messages(messages, input_context=input_context):
  File "/app/src/agents/common/base.py", line 65, in stream_messages
    async for msg, metadata in graph.astream(
  File "/app/.venv/lib/python3.12/site-packages/langgraph/pregel/main.py", line 2888, in astream
    async with AsyncPregelLoop(
               ^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/langgraph/pregel/_loop.py", line 1264, in __aenter__
    saved = await self.checkpointer.aget_tuple(self.checkpoint_config)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/langgraph/checkpoint/sqlite/aio.py", line 330, in aget_tuple
    await self.setup()
  File "/app/.venv/lib/python3.12/site-packages/langgraph/checkpoint/sqlite/aio.py", line 284, in setup
    if not self.conn.is_alive():
           ^^^^^^^^^^^^^^^^^^
AttributeError: 'Connection' object has no attribute 'is_alive'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/server/routers/chat_router.py", line 209, in check_and_handle_interrupts
    state = await graph.aget_state(langgraph_config)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/langgraph/pregel/main.py", line 1308, in aget_state
    saved = await checkpointer.aget_tuple(config)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/langgraph/checkpoint/sqlite/aio.py", line 330, in aget_tuple
    await self.setup()
  File "/app/.venv/lib/python3.12/site-packages/langgraph/checkpoint/sqlite/aio.py", line 284, in setup
    if not self.conn.is_alive():
           ^^^^^^^^^^^^^^^^^^
AttributeError: 'Connection' object has no attribute 'is_alive'

12-23 21:26:07 INFO chat_router.py:691: Loaded 2 messages from new storage for thread 6dfac0c5-f9c3-43a6-87a9-8f9821265503
12-23 21:26:08 INFO: 172.18.0.7:56152 - "GET /api/chat/agent/ChatbotAgent/history?thread_id=6dfac0c5-f9c3-43a6-87a9-8f9821265503 HTTP/1.1" 200
12-23 21:26:24 INFO: 127.0.0.1:50210 - "GET /api/system/health HTTP/1.1" 200
12-23 21:26:54 INFO: 127.0.0.1:33856 - "GET /api/system/health HTTP/1.1" 200
12-23 21:27:24 INFO: 127.0.0.1:52718 - "GET /api/system/health HTTP/1.1" 200
12-23 21:27:54 INFO: 127.0.0.1:43938 - "GET /api/system/health HTTP/1.1" 200
12-23 21:28:24 INFO: 127.0.0.1:49054 - "GET /api/system/health HTTP/1.1" 200
12-23 21:28:54 INFO: 127.0.0.1:34152 - "GET /api/system/health HTTP/1.1" 200
12-23 21:29:24 INFO: 127.0.0.1:50066 - "GET /api/system/health HTTP/1.1" 200
12-23 21:29:55 INFO: 127.0.0.1:36156 - "GET /api/system/health HTTP/1.1" 200
12-23 21:30:25 INFO: 127.0.0.1:58084 - "GET /api/system/health HTTP/1.1" 200
12-23 21:30:55 INFO: 127.0.0.1:51648 - "GET /api/system/health HTTP/1.1" 200
12-23 21:31:25 INFO: 127.0.0.1:36490 - "GET /api/system/health HTTP/1.1" 200
12-23 21:31:55 INFO: 127.0.0.1:47160 - "GET /api/system/health HTTP/1.1" 200
PS C:\Users\SXB>

3️⃣ 相关截图

Image Image

#️⃣ 其他相关信息

✅ 如果问题与模型调用相关,请尝试切换到其他在线模型

wzb83889 avatar Dec 23 '25 13:12 wzb83889

最新版本已修复,建议直接使用 0.4beta

xerrors avatar Dec 23 '25 14:12 xerrors