Skip to content

Ollama connection closing in 5 min #2679

@ScaryBeats01

Description

@ScaryBeats01

Describe the Bug

Allways karakeep closes the connection with ollama on 5 min. I changed the env variables, but I still have the error. I tried recreating the docker containers, and still have the error.

Steps to Reproduce

Try one extense job.

Expected Behaviour

Not closing the connection with ollama.

Screenshots or Additional Context

I run karakeep with this config basically:

INFERENCE_FETCH_TIMEOUT_SEC=18000
INFERENCE_JOB_TIMEOUT_SEC=18000
INFERENCE_NUM_WORKERS=1
INFERENCE_CONTEXT_LENGTH=2048
INFERENCE_ENABLE_AUTO_SUMMARIZATION=true
NEXTAUTH_URL=http://localhost:3000
OLLAMA_BASE_URL=http://host.docker.internal:11435
INFERENCE_TEXT_MODEL=gemma3:latest
INFERENCE_IMAGE_MODEL=glm-ocr:latest
EMBEDDING_TEXT_MODEL=nomic-embed-text-v2-moe:latest
OCR_USE_LLM=true
KARAKEEP_VERSION=release

Device Details

No response

Exact Karakeep Version

0.31.0

Environment Details

Docker, W11

Debug Logs

Logs:
web-1 | 2026-04-09T10:49:30.168Z error: [inference][26400] inference job failed: TypeError: fetch failed
web-1 | TypeError: fetch failed
web-1 | at node:internal/deps/undici/undici:16416:13
web-1 | at async post (file:///app/apps/workers/dist/index.js:941:19)
web-1 | at async Ollama.processStreamableRequest (file:///app/apps/workers/dist/index.js:1046:22)
web-1 | at async OllamaInferenceClient.runModel (file:///app/apps/workers/dist/index.js:26111:26)
web-1 | at async OllamaInferenceClient.inferFromText (file:///app/apps/workers/dist/index.js:26152:10)
web-1 | at async inferTagsFromText (file:///app/apps/workers/dist/index.js:65261:9)
web-1 | at async inferTags (file:///app/apps/workers/dist/index.js:65279:49)
web-1 | at async runTagging (file:///app/apps/workers/dist/index.js:65391:15)
web-1 | at async runOpenAI (file:///app/apps/workers/dist/index.js:65462:4)
web-1 | at async file:///app/apps/workers/dist/shared-server-Cp5ajkIj.js:28380:19
web-1 | 2026-04-09T10:49:30.216Z info: [inference][26400] Starting an inference job for bookmark with id "i2nf7qgz1v9x1kfdp4paozsh"
web-1 | 2026-04-09T10:49:33.222Z info: <-- HEAD /api/health
web-1 | 2026-04-09T10:49:33.223Z info: --> HEAD /api/health 200 1ms
web-1 | s6-rc: info: service legacy-services: stopping
web-1 | s6-rc: info: service legacy-services successfully stopped
web-1 | s6-rc: info: service legacy-cont-init: stopping
web-1 | s6-rc: info: service svc-workers: stopping
web-1 | s6-rc: info: service svc-web: stopping
web-1 | 2026-04-09T10:49:59.253Z info: Received SIGTERM, shutting down ...
web-1 | 2026-04-09T10:49:59.263Z info: Shutting down crawler, lowPriorityCrawler, inference, search, adminMaintenance, video, feed, assetPreprocessing, webhook, ruleEngine, backup workers ...
web-1 | 2026-04-09T10:49:59.264Z info: [import] Stopping import polling worker
web-1 | s6-rc: info: service legacy-cont-init successfully stopped
web-1 | s6-rc: info: service fix-attrs: stopping
web-1 | s6-rc: info: service fix-attrs successfully stopped
web-1 | s6-rc: info: service svc-web successfully stopped
web-1 | s6-rc: info: service svc-workers successfully stopped
web-1 | s6-rc: info: service init-db-migration: stopping
web-1 | s6-rc: info: service init-db-migration successfully stopped
web-1 | s6-rc: info: service s6rc-oneshot-runner: stopping
web-1 | s6-rc: info: service s6rc-oneshot-runner successfully stopped
meilisearch-1 exited with code 143
chrome-1 exited with code 143
web-1 exited with code 137

Ollama logs:
[GIN] 2026/04/09 - 12:48:24 | 200 | 13.9516ms | 127.0.0.1 | HEAD "/"
[GIN] 2026/04/09 - 12:48:24 | 200 | 69.8432ms | 127.0.0.1 | GET "/api/ps"
time=2026-04-09T12:49:30.273+02:00 level=INFO source=runner.go:922 msg="aborting completion request due to client closing the connection"
[GIN] 2026/04/09 - 12:49:30 | 500 | 5m0s | 127.0.0.1 | POST "/api/generate"
time=2026-04-09T12:49:30.282+02:00 level=DEBUG source=sched.go:404 msg="context for request finished" runner.name=registry.ollama.ai/library/gemma3:latest runner.inference="[{ID:8680a646-0c00-0000-0000-000000000000 Library:Vulkan}]" runner.size="3.9 GiB" runner.vram="3.9 GiB" runner.parallel=1 runner.pid=23276 runner.model=C:\Users\user.ollama\models\blobs\sha256-aeda25e63ebd698fab8638ffb778e68bed908b960d39d0becc650fa981609d25 runner.num_ctx=2048
time=2026-04-09T12:49:30.547+02:00 level=DEBUG source=sched.go:309 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/gemma3:latest runner.inference="[{ID:8680a646-0c00-0000-0000-000000000000 Library:Vulkan}]" runner.size="3.9 GiB" runner.vram="3.9 GiB" runner.parallel=1 runner.pid=23276 runner.model=C:\Users\user.ollama\models\blobs\sha256-aeda25e63ebd698fab8638ffb778e68bed908b960d39d0becc650fa981609d25 runner.num_ctx=2048 duration=5m0s
time=2026-04-09T12:49:30.549+02:00 level=DEBUG source=sched.go:327 msg="after processing request finished event" runner.name=registry.ollama.ai/library/gemma3:latest runner.inference="[{ID:8680a646-0c00-0000-0000-000000000000 Library:Vulkan}]" runner.size="3.9 GiB" runner.vram="3.9 GiB" runner.parallel=1 runner.pid=23276 runner.model=C:\Users\user.ollama\models\blobs\sha256-aeda25e63ebd698fab8638ffb778e68bed908b960d39d0becc650fa981609d25 runner.num_ctx=2048 refCount=0
time=2026-04-09T12:49:33.311+02:00 level=DEBUG source=sched.go:672 msg="evaluating already loaded" model=C:\Users\user.ollama\models\blobs\sha256-aeda25e63ebd698fab8638ffb778e68bed908b960d39d0becc650fa981609d25
time=2026-04-09T12:49:35.371+02:00 level=DEBUG source=server.go:1538 msg="completion request" images=0 prompt=8504 format=""
time=2026-04-09T12:49:35.523+02:00 level=DEBUG source=vocabulary.go:52 msg="adding bos token to prompt" id=2
time=2026-04-09T12:49:35.538+02:00 level=WARN source=runner.go:187 msg="truncating input prompt" limit=2048 prompt=2322 keep=4 new=2048
time=2026-04-09T12:49:59.432+02:00 level=DEBUG source=sched.go:404 msg="context for request finished" runner.name=registry.ollama.ai/library/gemma3:latest runner.inference="[{ID:8680a646-0c00-0000-0000-000000000000 Library:Vulkan}]" runner.size="3.9 GiB" runner.vram="3.9 GiB" runner.parallel=1 runner.pid=23276 runner.model=C:\Users\user.ollama\models\blobs\sha256-aeda25e63ebd698fab8638ffb778e68bed908b960d39d0becc650fa981609d25 runner.num_ctx=2048
time=2026-04-09T12:49:59.435+02:00 level=INFO source=runner.go:922 msg="aborting completion request due to client closing the connection"
time=2026-04-09T12:49:59.437+02:00 level=DEBUG source=sched.go:309 msg="runner with non-zero duration has gone idle, adding timer" runner.name=registry.ollama.ai/library/gemma3:latest runner.inference="[{ID:8680a646-0c00-0000-0000-000000000000 Library:Vulkan}]" runner.size="3.9 GiB" runner.vram="3.9 GiB" runner.parallel=1 runner.pid=23276 runner.model=C:\Users\user.ollama\models\blobs\sha256-aeda25e63ebd698fab8638ffb778e68bed908b960d39d0becc650fa981609d25 runner.num_ctx=2048 duration=5m0s
time=2026-04-09T12:49:59.438+02:00 level=DEBUG source=sched.go:327 msg="after processing request finished event" runner.name=registry.ollama.ai/library/gemma3:latest runner.inference="[{ID:8680a646-0c00-0000-0000-000000000000 Library:Vulkan}]" runner.size="3.9 GiB" runner.vram="3.9 GiB" runner.parallel=1 runner.pid=23276 runner.model=C:\Users\user.ollama\models\blobs\sha256-aeda25e63ebd698fab8638ffb778e68bed908b960d39d0becc650fa981609d25 runner.num_ctx=2048 refCount=0

Have you checked the troubleshooting guide?

  • I have checked the troubleshooting guide and I haven't found a solution to my problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstatus/untriagedThis issue needs triaging to confirm it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions