Replies: 8 comments 10 replies
|
结论先行:这不是模型的问题,也不是你配的 1 小时超时没生效的问题——这是 Node.js 底层 fetch 客户端(undici)的 bodyTimeout,默认就是 300 秒(5 分钟),到点就把连接掐了。你配置里的 为什么是 5 分钟:undici 的 分步排查:
请补充:dsh 版本( |
|
补充一个相关情况:如果是本地 llama.cpp (English: on |
|
Source-verified at 1. The pi-ai adapter forwards it verbatim into the SDK stream options:
So your 2. There's a SECOND, independent 5-minute killer the thread missed: the harness's own idle watchdog defaults to the same 300 000 ms.
Your stack shows undici's llm-pi-ai:
providers:
ollama:
...
timeoutMs: 3600000 # reaches the pi-ai SDK (adapter.ts:127)
streamIdleTimeoutMs: 3600000 # harness idle watchdog (default 300_000; max 2_147_483_647 ms)Note the watchdog also covers the |
|
感谢反馈。你的情况和我的不同,原因也确认了:Ollama 在生成工具调用参数(write 的整个文件内容)期间不向客户端发送任何字节,也没有 keepalive,所以 Node 底层 undici 的 bodyTimeout(300 秒,dsh 没有对应配置)会先把连接掐掉;streamIdleTimeoutMs 调多大都没用。llama.cpp 之所以没有这个问题,是因为它每 30 秒发一次 SSE ping。 目前 dsh 侧没有配置能改 undici 的超时,只能通过 #3157 里的 node_modules 补丁。我可以做一个很小的插件,在进程启动时把 undici 的 headersTimeout/bodyTimeout 调大(影响整个 dsh 进程的 fetch,但对本地单用户部署基本无害)。如果你愿意试,我发布后在这里贴链接。 (English: Ollama sends nothing back, not even a keepalive, while it generates tool-call arguments, so Node's 300 s body timeout kills the connection before anything dsh controls. There's no dsh setting for that timeout; llama.cpp avoids the whole issue by sending a ping every 30 s. If it helps, I can put together a small plugin that raises those timeouts for the whole dsh process.) |
我遇到过同样的超时(在 bodyTimeout 场景,来自 dsh-local-ai 的排障)特别是长输出(如 write 场景)。Ollama 服务端默认 keepalive,undici 300 秒后断连,超时错误就是这么来的:
如果问题依旧,欢迎贴出 Ollama 日志与请求参数,我再帮你看。 |
|
插件发布了:https://github.com/d3vmeh/dsh-fetch-timeouts 安装: 默认把 headersTimeout 和 bodyTimeout 都调到 30 分钟,可以在 profile 的 cordis.patch.yml 里改。记得同时把 ollama 路由上的 (English: published. Install with the line above; defaults to 30 minutes for both timeouts, configurable in your profile patch. Also raise |
|
@PerryLink 你的评论显示为乱码(中文都变成了问号),能重新发一下吗?从能看到的部分猜测你提到了 keep_alive、OLLAMA_NUM_PARALLEL 和在 dsh-local-ai 里处理长时间静默;很想看完整内容。另外 undici 超时的插件已经发了:https://github.com/d3vmeh/dsh-fetch-timeouts |


插件发布了:https://github.com/d3vmeh/dsh-fetch-timeouts
安装:
默认把 headersTimeout 和 bodyTimeout 都调到 30 分钟,可以在 profile 的 cordis.patch.yml 里改。记得同时把 ollama 路由上的
streamIdleTimeoutMs和timeoutMs也调大,否则 dsh 自己的看门狗会先触发。它是全进程生效的(dsh 里所有 fetch 都会用更长的超时),在本地单人使用的机器上没问题;如果设置了 NODE_USE_ENV_PROXY,代理仍然有效。Windows 上我没有测过,试了之后欢迎反馈。(English: published. Install with the line above; defaults to 30 minutes for both timeouts, configurable in your profile patch. Also raise
streamIdleTimeoutMsandtimeoutMson the ollama route or dsh's own watchdog fires first. Process-wide, proxy env vars still honoured. Not tested on Windows yet, feedback welcome.)