[GH-ISSUE #5081] Timeout for long generation #65242

Closed
opened 2026-05-03 20:08:06 -05:00 by GiteaMirror · 8 comments
Owner

Originally created by @slavonnet on GitHub (Jun 16, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/5081

Originally assigned to: @dhiltgen on GitHub.

What is the issue?

https://github.com/ollama/ollama-js/issues/103

After 5 minutes of execution, 500 error is received. There is no way to increase the time. I use stream: false.
keepalive: 15m and env OLLAMA_KEEP_ALIVE=15m does not help

июн 16 17:43:34 ai ollama[3733311]: [GIN] 2024/06/16 - 17:43:34 | 500 |          5m1s |       127.0.0.1 | POST     "/api/chat"

OS

Linux

GPU

Nvidia

CPU

Intel

Ollama version

0.1.45-rc1

Originally created by @slavonnet on GitHub (Jun 16, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/5081 Originally assigned to: @dhiltgen on GitHub. ### What is the issue? https://github.com/ollama/ollama-js/issues/103 After 5 minutes of execution, 500 error is received. There is no way to increase the time. I use `stream: false`. `keepalive: 15m` and env `OLLAMA_KEEP_ALIVE=15m` does not help ``` июн 16 17:43:34 ai ollama[3733311]: [GIN] 2024/06/16 - 17:43:34 | 500 | 5m1s | 127.0.0.1 | POST "/api/chat" ``` ### OS Linux ### GPU Nvidia ### CPU Intel ### Ollama version 0.1.45-rc1
GiteaMirror added the bug label 2026-05-03 20:08:07 -05:00
Author
Owner

@slavonnet commented on GitHub (Jun 16, 2024):

i found parametr in llama.cpp

-to N, --timeout N: Server read/write timeout in seconds. Default 600
<!-- gh-comment-id:2171738014 --> @slavonnet commented on GitHub (Jun 16, 2024): i found parametr in llama.cpp ``` -to N, --timeout N: Server read/write timeout in seconds. Default 600 ```
Author
Owner

@hopperelec commented on GitHub (Jun 16, 2024):

600 seconds is 10 minutes, though, and I don't see anywhere where Ollama is overriding this

<!-- gh-comment-id:2171739999 --> @hopperelec commented on GitHub (Jun 16, 2024): 600 seconds is 10 minutes, though, and I don't see anywhere where Ollama is overriding this
Author
Owner

@slavonnet commented on GitHub (Jun 16, 2024):

OK, what are the options to fix the 5 minute limit?

<!-- gh-comment-id:2171741650 --> @slavonnet commented on GitHub (Jun 16, 2024): OK, what are the options to fix the 5 minute limit?
Author
Owner

@slavonnet commented on GitHub (Jun 16, 2024):

i have 3 x 4060ti 16gb and try run Mixtral 8x22b model (half run on gpu and half on cpu)

<!-- gh-comment-id:2171741995 --> @slavonnet commented on GitHub (Jun 16, 2024): i have 3 x 4060ti 16gb and try run Mixtral 8x22b model (half run on gpu and half on cpu)
Author
Owner

@slavonnet commented on GitHub (Jun 16, 2024):

89c79bec8c/llm/ext_server/httplib.h (L26)

<!-- gh-comment-id:2171744052 --> @slavonnet commented on GitHub (Jun 16, 2024): https://github.com/ollama/ollama/blob/89c79bec8cf7a7b04f761fcc5306d2edf47a4164/llm/ext_server/httplib.h#L26
Author
Owner

@slavonnet commented on GitHub (Jun 16, 2024):

https://github.com/ollama/ollama/pull/5084

<!-- gh-comment-id:2171746658 --> @slavonnet commented on GitHub (Jun 16, 2024): https://github.com/ollama/ollama/pull/5084
Author
Owner

@dhiltgen commented on GitHub (Nov 6, 2024):

This was most likely a load timeout. We added a new env var OLLAMA_LOAD_TIMEOUT to adjust this timeout for systems that take longer than 5m to load the model.

<!-- gh-comment-id:2458513769 --> @dhiltgen commented on GitHub (Nov 6, 2024): This was most likely a load timeout. We added a new env var `OLLAMA_LOAD_TIMEOUT` to adjust this timeout for systems that take longer than 5m to load the model.
Author
Owner

@SegFaulty commented on GitHub (Feb 24, 2025):

After investigating on this isseue, here a maybe helpfully comment:

If you run bigger models on consumer hardware, you will instant discover the hardcoded 5 Minute timeout for non streaming requests.

Our Solution to handle long running (like 10 minutes) requests:

  • stream=true,
  • collect all parts in the low level api request method (curl has a callback option (writefunction) to concate it relative easy)
  • return it like a one shot request response.
<!-- gh-comment-id:2678021167 --> @SegFaulty commented on GitHub (Feb 24, 2025): After investigating on this isseue, here a maybe helpfully comment: If you run bigger models on consumer hardware, you will instant discover the hardcoded 5 Minute timeout for non streaming requests. Our Solution to handle long running (like 10 minutes) requests: - stream=true, - collect all parts in the low level api request method (curl has a callback option (writefunction) to concate it relative easy) - return it like a one shot request response.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#65242