Skip to content

server : add kill switch when server is stuck - #20277

Merged
ggerganov merged 1 commit into
masterfrom
gg/server-kill-switch
Mar 9, 2026
Merged

ggerganov merged 1 commit into
masterfrom
gg/server-kill-switch

Conversation

@ggerganov

Copy link
Copy Markdown
Member

ref #20087 (comment)

Sometimes the server enters an infinite loop of empty batches. This change makes it easier to debug such cases.

@ggerganov
ggerganov requested a review from ngxson as a code owner March 9, 2026 07:37
@aldehir

aldehir commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

I managed to reproduce this reliably with gpt-oss-20b and 120b.

Windows & Nvidia RTX 3090.

repro.py
server.log 1
server.log 2

The reproducer runs an agentic scenario, and then runs it again. The second run is what triggers the loop.

Let me know if there's anything else I can provide.

@ggerganov
ggerganov merged commit 107d599 into master Mar 9, 2026
71 of 75 checks passed
@ggerganov
ggerganov deleted the gg/server-kill-switch branch March 9, 2026 08:33
std::vector<server_slot> slots;

int slots_debug = 0;
int n_empty_consequtive = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ggerganov
Did you mean consecutive?

alam0rt added a commit to alam0rt/nix-config that referenced this pull request Mar 14, 2026
…ound)

- -c 32768 → 65536: openclaw compaction was failing at 41784 tokens
- Remove --ctx-checkpoints 1: triggers empty-batch loop bug in b8255
  which causes the kill-switch abort (server-context.cpp:2634)
  See: ggml-org/llama.cpp#20277
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
@asbelin

asbelin commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

https://huggingface.co/unsloth/gemma-4-12B-it-qat-GGUF/discussions/5

[Bug] Fatal errors when loading unsloth/gemma-4-12B-it-qat-GGUF with MTP draft model on RTX 5070 Ti — LM Studio 0.4.16

Environment:
Software: LM Studio 0.4.16
Repository: unsloth/gemma-4-12B-it-qat-GGUF
Main Model: gemma-4-12B-it-qat-UD-Q4_K_XL.gguf
Draft/Speculative Model: gemma-4-12B-it-Q4_0-MTP.gguf (from unsloth/gemma-4-12B-it-qat-mtp-GGUF)
Operating System: Windows 11
Hardware: NVIDIA RTX 5070 Ti (Blackwell architecture)

Observed behaviour:
The developer log captures two consecutive load attempts, both ending in a fatal error.

Scenario 1 — Flash Attention enabled (AUTO mode):
Model load proceeds until the warmup stage, then crashes with an assertion failure in the CUDA Flash Attention backend:

gemma4 architecture detected, using AUTO flash attention mode
...
common_init_from_params: warming up the model with an empty run
llm-engine\llama.cpp\ggml\src\ggml-cuda\fattn-common.cuh:1110:
GGML_ASSERT(max_blocks_per_sm > 0) failed

Scenario 2 — Flash Attention disabled (fallback after Scenario 1):
LM Studio retries with FA disabled (llama_kv_cache: ... FA is not enabled - padding V cache to 2048). Both the target and draft models load, and speculative decoding is initialised:

common_speculative_impl_draft_simple: adding speculative implementation 'draft-simple'
srv load_model: speculative decoding context initialized

On the first inference request, decoding fails due to KV-cache position mismatch:

E init: the tokens of sequence 0 in the input batch have inconsistent sequence positions:
the last position stored in the memory module of the context (i.e. the KV cache) for sequence 0 is X = 53
the tokens for sequence 0 in the input batch have a starting position of Y = 0
it is required that the sequence positions remain consecutive: Y = X + 1

E decode: failed to initialize batch
E llama_decode: failed to decode, ret = -1
E process: failed to decode draft batch, ret = -1, error = 0
E srv update_slots: failed to process speculative batch

The server then terminates with:

llm-engine\llama.cpp\tools\server\server-context.cpp:3190:
fatal error - please provide logs and repro in https://github.com/ggml-org/llama.cpp/pull/20277

Request:
Could you confirm whether this behaviour is specific to the MTP tensor layout of this GGUF conversion, or whether it is a known upstream llama.cpp issue (cf. PR #20277) affecting Gemma-4 MTP on Blackwell GPUs? Any guidance on a working configuration would be appreciated.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants