DSH | dsh-fetch-timeouts | Stop slow local models (Ollama, LM Studio) from being cut off at 5 minutes #5124
Replies: 1 comment 1 reply
|
Verified the tarball ( Why it dies at exactly 5:00. Node's fetch (undici) Agent defaults are Cross-link #5118 (global dispatcher). Your plugin's mechanism is a deliberate
One tradeoff to state plainly: with 30-minute timers, a hung LLM provider stalls the whole host until either the pi-ai watchdog fires (defaults 300s, so normally it wins) or your timer expires. After raising The end state is indeed the pi-ai custom- |
Uh oh!
There was an error while loading. Please reload this page.
Project URL:
https://github.com/d3vmeh/dsh-fetch-timeouts
npm: https://www.npmjs.com/package/dsh-fetch-timeouts
Introduction:
If you run DSH against Ollama or LM Studio and long turns die at exactly 5:00 with
Failure reason: terminated(orUND_ERR_BODY_TIMEOUT/UND_ERR_HEADERS_TIMEOUT), even after raisingstreamIdleTimeoutMs, this is the missing piece. Node's built-infetchgives up when a server sends no headers for 300 seconds, or no body bytes for 300 seconds, and DSH has no setting for those two timers. Ollama and LM Studio send nothing while a model thinks or generates a large tool call (for example a whole file forwrite), so the connection is cut before anything DSH controls gets a say. llama.cpp users are usually fine becausellama-serverpings every 30 seconds.dsh-fetch-timeouts raises those two timeouts for the whole DSH process (default 30 minutes each). It replaces the node_modules patch people have been applying by hand in #3157 and #4518.
How it integrates with DSH:
A tiny cordis plugin (about 40 lines). At startup it installs an
undiciAgentwith your timeouts as Node's global fetch dispatcher, and restores the previous one when unloaded. IfNODE_USE_ENV_PROXYis set it installs undici's proxy-aware agent instead, soHTTP_PROXY,HTTPS_PROXYandNO_PROXYkeep working. It ships adsh.bundlepatch, so installation is one line:The defaults are enough for most people. To change them, in
~/.dsh/profiles/web/cordis.patch.yml:Also raise DSH's own watchdog on the provider route, or it fires first:
What you should know:
fetchin the DSH host gets the longer limits, so a genuinely dead connection takes longer to notice. Fine on a single-user machine.fetch; when DSH exposes these timeouts itself, this plugin becomes unnecessary.Related: dsh-llm-gate (#4995) queues requests so a single-slot llama.cpp is not overloaded, and dsh-context-budget (#5078) keeps the context at a size the GPU handles well. This one is the third piece for local models: the HTTP layer.
MIT License. Feedback welcome!
> Unofficial project, independently developed and maintained by community members.
All reactions