From d7ba99c4850bd687621f13329490dc28f28f17c9 Mon Sep 17 00:00:00 2001 From: SoftwareRenderer <138734813+SoftwareRenderer@users.noreply.github.com> Date: Fri, 13 Mar 2026 13:58:09 -0400 Subject: [PATCH] server: reset counter related to kill-switch on client error (#20513) * server: reset kill-switch on client error This avoids triggering a server kill switch. If the client sends a request that exceeds the configured context size, an appropriate HTTP 400 response is provided and no tokens are generated. However since no tokens are generated, update_slots() increments n_empty_consecutive. If the client sends 3 such messages in a row, the server terminates. * moved counter reset as per recommendation * cont : minor --------- Co-authored-by: Georgi Gerganov --- tools/server/server-context.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/server/server-context.cpp b/tools/server/server-context.cpp index b4373c101b..c47ad876cb 100644 --- a/tools/server/server-context.cpp +++ b/tools/server/server-context.cpp @@ -1189,6 +1189,9 @@ private: ? SLOT_STATE_WAIT_OTHER // wait for the parent to process prompt : SLOT_STATE_STARTED; + // reset server kill-switch counter + n_empty_consecutive = 0; + SLT_INF(slot, "processing task, is_child = %d\n", slot.task->is_child()); return true; }