Files
ik_llama.cpp/examples/server/server-context.cpp
Heath Albritton bc549da0f7 server : catch sampler/grammar exceptions to avoid process abort (#1725) (#1726)
Wrap the two slot-level sample/accept call sites in
try/catch (std::exception). On exception: log, send_error to the
task, release the slot, continue serving. Matches the existing
try/catch around common_sampler_init in the same file.

Without this, llama_grammar_accept_token throwing
"Unexpected empty grammar stack after accepting piece: <pad> (0)"
(reproducible on Gemma 4 + json_schema + ctx_shift, see #1725)
unwinds out of update_slots -> queue start_loop -> main, hits
std::terminate, and aborts the whole server process.
2026-05-03 08:21:09 +03:00

182 KiB