LCP slot reuse segfaults on identical-prompt retry (server_tokens::get_common_prefix) #1
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug: Identical-prompt LCP reuse segfaults the server
Summary
Submitting the same prompt twice to the server causes a deterministic segfault in
server_tokens::get_common_prefix()during LCP slot reuse. This is a production blocker for any agentic workload that retries identical requests.Reproduction
--ctx-checkpoints 50 --cache-ram 11500(or any config that enables the prompt cache)Backtrace (from gdb session, Thread 1)
Root Cause Hypothesis
index_find_best()returns aprompt_iteratorinto thestatesdeque. After a prioralloc()orload()erases an entry viastates.erase(it_best), the index may still reference the erased entry. On the next call,get_common_prefix()dereferences a dangling iterator -> segfault at address0xffffffff.The
probe_recent_match_cachemechanism (which cachesprompt_iteratorvalues) is the likely culprit -- recorded iterators become invalid afterstates.erase()without being invalidated.Severity
Blocker. Any retry logic in agentic workloads (including the r harness loadgen) can trigger this.
Environment
apply-pr-26323(HEADc0ce81f43)~/src/llama.cpp/build/bin/llama-server--ctx-checkpoints 50 --cache-ram 11500 --reasoning-preserveReproduction Script
See
~/work/atsinfer_Launcher/experiments/think-ab.shandlcp-repro.shfor automated repro. Thethink-ab.shscript reliably crashes on round 2 of thinking-ON concurrent requests.