Skip to content

Misc. bug: Llama-server.exe in router mode errors and bails on processing image task, no error when in non-router mode #18170

Open

Description

@alan-l

Name and Version

llama-server.exe, currently testing with b7445

Operating systems

Windows

Which llama.cpp modules do you know to be affected?

llama-server

Command line

llama-server.exe --host 0.0.0.0 --port 8080 --models-preset "./llama-server.ini" --models-max 1

Problem description & steps to reproduce

Llama-server.exe running in ini-mode loaded as per above, decoding image for detail extraction bails several minutes into the task. Running llama-server.exe in non-routing mode leads to task completion and successful extraction of image detail into requested format.

Logs seem to indicate that the image decoding process completes, but the connection between the server instance of llama-server.exe and the router instance of llama-server.exe broke. I've tried changing --timeout to 900 and 1200, but it doesn't seem to help.

Tested on CUDA, Vulkan, and CPU-only, all with same result.

First Bad Commit

Haven't yet tested with any version prior to b7445.

Relevant log output

Relevant log entries from failed/bailed run (ini-mode):

[49944] 1.39.757.936 I slot launch_slot_: id  3 | task 0 | processing task
[49944] 1.39.757.950 I slot update_slots: id  3 | task 0 | new prompt, n_ctx_slot = 131072, n_keep = -1, task.n_tokens = 2037
[49944] 1.39.757.967 I slot update_slots: id  3 | task 0 | n_tokens = 0, memory_seq_rm [0, end)
[49944] 1.39.758.339 I slot update_slots: id  3 | task 0 | prompt processing progress, n_tokens = 17, batch.n_tokens = 17, progress = 0.008346
[49944] 1.40.612.749 I slot update_slots: id  3 | task 0 | n_tokens = 17, memory_seq_rm [17, end)
[49944] 1.40.613.256 I srv  process_chun: processing image...
[49944] 1.40.613.556 I encoding image slice...
3.06.023.589 I srv  log_server_r: request: GET /props 192.168.1.128 200
7.12.439.716 E srv    operator(): http client error: Failed to read connection
7.12.440.297 I srv  log_server_r: request: POST /v1/chat/completions 192.168.1.128 500
[49944] 6.40.478.133 W srv          stop: cancel task, id_task = 0
[49944] 6.40.478.184 I srv  log_server_r: request: POST /v1/chat/completions 127.0.0.1 200
[49944] 7.22.439.912 I image slice encoded in 341828 ms
[49944] 7.22.440.005 I decoding image batch 1/1, n_tokens_batch = 2014
[49944] 8.31.170.649 I image decoded (batch 1/1) in 68730 ms
[49944] 8.31.170.700 I srv  process_chun: image processed in 410558 ms
[49944] 8.31.177.850 I slot update_slots: id  3 | task 0 | prompt processing progress, n_tokens = 2037, batch.n_tokens = 6, progress = 1.000000
[49944] 8.31.177.878 I slot update_slots: id  3 | task 0 | prompt done, n_tokens = 2037, batch.n_tokens = 6
[49944] 8.31.522.494 I slot      release: id  3 | task 0 | stop processing: n_tokens = 2037, truncated = 0
[49944] 8.31.522.509 I srv  update_slots: all slots are idle

----------

Relevant log entries from successful run (non-ini-mode):

[58771] 0.36.547.405 I slot launch_slot_: id  3 | task 0 | processing task
[58771] 0.36.547.416 I slot update_slots: id  3 | task 0 | new prompt, n_ctx_slot = 65536, n_keep = -1, task.n_tokens = 2039
[58771] 0.36.547.421 I slot update_slots: id  3 | task 0 | n_tokens = 0, memory_seq_rm [0, end)
[58771] 0.36.547.511 I slot update_slots: id  3 | task 0 | prompt processing progress, n_tokens = 19, batch.n_tokens = 19, progress = 0.009318
[58771] 0.42.285.204 I slot update_slots: id  3 | task 0 | n_tokens = 19, memory_seq_rm [19, end)
[58771] 0.42.285.378 I srv  process_chun: processing image...
[58771] 0.42.285.821 I encoding image slice...
[58771] 3.17.017.498 I image slice encoded in 154727 ms
[58771] 3.17.017.578 I decoding image batch 1/1, n_tokens_batch = 2014
[58771] 4.41.136.485 I image decoded (batch 1/1) in 84117 ms
[58771] 4.41.136.695 I srv  process_chun: image processed in 238844 ms
[58771] 4.41.152.082 I slot update_slots: id  3 | task 0 | prompt processing progress, n_tokens = 2039, batch.n_tokens = 6, progress = 1.000000
[58771] 4.41.152.136 I slot update_slots: id  3 | task 0 | prompt done, n_tokens = 2039, batch.n_tokens = 6
[58771] 10.38.953.784 I slot print_timing: id  3 | task 0 | 
[58771] prompt eval time =  247745.45 ms /  2039 tokens (  121.50 ms per token,     8.23 tokens per second)
[58771]        eval time =  354642.84 ms /   407 tokens (  871.36 ms per token,     1.15 tokens per second)
[58771]       total time =  602388.30 ms /  2446 tokens
[58771] 10.38.953.840 I slot      release: id  3 | task 0 | stop processing: n_tokens = 2445, truncated = 0
[58771] 10.38.953.849 I srv  update_slots: all slots are idle

Activity

  1. added
    bug
    mtmd
    and removed on Dec 18, 2025
  2. alan-l commented on Dec 24, 2025

    @alan-l
    Author

    Seems this isn't limited to image processing. When I input a very large text input (30k chars, approx 8k tokens), processing bails somewhere around 2048 and 4096 tokens.


    2025-12-24 08:54:24.373: [53046] 1.36.027.616 I slot launch_slot_: id 3 | task 0 | processing task
    2025-12-24 08:54:24.373: [53046] 1.36.027.659 I slot update_slots: id 3 | task 0 | new prompt, n_ctx_slot = 131072, n_keep = -1, task.n_tokens = 7102
    2025-12-24 08:54:24.373: [53046] 1.36.027.667 I slot update_slots: id 3 | task 0 | n_tokens = 0, memory_seq_rm [0, end)
    2025-12-24 08:54:24.373: [53046] 1.36.028.305 I slot update_slots: id 3 | task 0 | prompt processing progress, n_tokens = 2048, batch.n_tokens = 2048, progress = 0.288369
    2025-12-24 08:57:23.903: [53046] 4.35.549.380 I slot update_slots: id 3 | task 0 | n_tokens = 2048, memory_seq_rm [2048, end)
    2025-12-24 08:57:23.903: [53046] 4.35.549.824 I slot update_slots: id 3 | task 0 | prompt processing progress, n_tokens = 4096, batch.n_tokens = 2048, progress = 0.576739
    2025-12-24 08:59:24.245: 6.36.016.667 E srv operator(): http client error: Failed to read connection
    2025-12-24 08:59:24.245: 6.36.016.921 I srv log_server_r: request: POST /v1/chat/completions 192.168.1.128 500
    2025-12-24 08:59:24.823: [53046] 6.36.468.156 W srv stop: cancel task, id_task = 0
    2025-12-24 08:59:24.823: [53046] 6.36.468.196 I srv log_server_r: request: POST /v1/chat/completions 127.0.0.1 200
    2025-12-24 09:01:26.963: [53046] 8.38.611.578 I slot release: id 3 | task 0 | stop processing: n_tokens = 4096, truncated = 0
    2025-12-24 09:01:26.963: [53046] 8.38.611.590 I srv update_slots: all slots are idle

  3. AlphasCodes commented on Dec 26, 2025

    @AlphasCodes

    I can confirm the issue with the router mode. I get this issue when using text input and I don't use any other inputs (e.g. images, ...) currently.

    • AMD Ryzen AI Max+ 395 128 GB (Framework Desktop Board)
    • vulkan docker version, build: 7542 (af3be13)
    • models are defined via *.ini file and related start parameters
    • it doesn't matter which model I use, I tested GPT OSS 120B and Ministral 3 14B all as GGUF models from Unsloth
    • it looks like some kind of timeout (e.g. after 5 minutes ???) but I already set the related parameter to 6000 seconds of timeout
    • it works when I don't use the router mode

    llama.cpp_router_mode_issue.txt

  4. alan-l commented on Dec 26, 2025

    @alan-l
    Author

    This issue seems to have been resolved with b7548 (maybe by #18180 and #18303). Like in #18311 I don't see my bug recurring in my tests.

  5. AlphasCodes commented on Dec 27, 2025

    @AlphasCodes

    The issue still persist for my use case with the current docker version build: 7549 (c9ced49). The error occurs after about 5 minutes and 29 seconds.

    My use case (all docker based) is a local n8n workflow to collect about 20 RSS feeds, preprocess the provided news and feed the information to the local running GPT OSS 120B model to extract all interesting information for me.

    llama.cpp_router_mode_issue_2.txt

  6. AlphasCodes commented on Dec 30, 2025

    @AlphasCodes

    The issue seems to be solved for me starting with version 7574. I cannot reproduce it anymore. I can use the router mode again.
    ...
    server : Cmdline arg -to changes http read timeout from current 600sec default (#18279)
    Prevent crash if TTFT >300sec, boosted to 90 days
    server : allow configurable HTTP timeouts for child models
    server : pass needed timeouts from params only
    ...

    Thank you everyone

  7. Material-Scientist commented on Apr 6, 2026

    @Material-Scientist

    Nope. The issue still persists.

    The timeout in router mode is hardcoded to 10min:

    600, // timeout_read (default to 10 minutes)

    Thus, setting --timeout has no effect.

    The only workaround is to launch w/o router mode.

  8. cknott commented on May 2, 2026

    @cknott

    not sure if the problem you described is the same that i experienced, as soon as i used llama-server in router mode requests with a more complex prompt would return a 500 error after some time, when sending the prompt directly to the spawned server on a different port it worked perfectly fine. i gave this problem to glm 5.1 and the "solution" was this change:

    diff --git a/tools/server/server-models.cpp b/tools/server/server-models.cpp
    index db6cbce..a770ada 100644
    --- a/tools/server/server-models.cpp
    +++ b/tools/server/server-models.cpp
    @@ -1351,7 +1351,7 @@ server_http_proxy::server_http_proxy(
         // wait for the first chunk (headers)
         {
             msg_t header;
    -        if (pipe->read(header, should_stop)) {
    +        if (pipe->read(header, []() { return false; })) {
                 SRV_DBG("%s", "received response headers\n");
                 this->status  = header.status;
                 this->headers = std::move(header.headers);
    

    i have no idea what other implications this might have as i have no idea of cpp / the llama.cpp code in general, so use this with caution. i rebuild llama.cpp and for now this is working.

  9. StephenSorriaux commented on Jun 11, 2026

    @StephenSorriaux

    Nope. The issue still persists.

    The timeout in router mode is hardcoded to 10min:

    llama.cpp/tools/server/server-cors-proxy.h

    Line 53 in 94ca829
    600, // timeout_read (default to 10 minutes)

    Thus, setting --timeout has no effect.

    The only workaround is to launch w/o router mode.

    That is correct. If you want to keep the router mode, another way is to apply a patch that increases this hard coded 10 minutes to an hour and rebuild... This is what I am doing, and had no issue since I bumped those timeouts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmtmdserverserver/api

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions