From c241764506997ab9df681755bfb93c870fdd84d7 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Aug 2026 07:51:11 +0000 Subject: [PATCH] =?UTF-8?q?fix(critical):=20wrap=20get=5Fscheduler=5Fconfi?= =?UTF-8?q?g=20in=20try-catch=20=E2=80=94=20prevent=20n=3D2=20engine=20cra?= =?UTF-8?q?sh=20cascade?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sub508 log: t2_n_2 → HTTP 500 → engine crash → ALL subsequent 24+ tests HTTP 500. The scheduler config call may throw if engine is in a bad state. Wrapping in try-catch ensures we return 400 (not 500) and the engine stays alive. --- qwen3_6_scripts/serving_chat.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/qwen3_6_scripts/serving_chat.py b/qwen3_6_scripts/serving_chat.py index f1c534fb..52064864 100644 --- a/qwen3_6_scripts/serving_chat.py +++ b/qwen3_6_scripts/serving_chat.py @@ -182,8 +182,14 @@ class OpenAIServingChat(OpenAIServing): # n > max_num_seqs deadlock guard: scheduler uses break (not continue) # when can_schedule(num_new_seqs=n) fails, so an n that exceeds # max_num_seqs permanently blocks the entire waiting queue with no error. - _sched_cfg = await self.engine_client.get_scheduler_config() - _max_seqs = _sched_cfg.max_num_seqs + # CRITICAL: Also guard against n=2+ with our competition config (max_num_seqs=1) + # to prevent engine crash (sub508: t2_n_2 → HTTP 500 → ALL subsequent 500). + try: + _sched_cfg = await self.engine_client.get_scheduler_config() + _max_seqs = _sched_cfg.max_num_seqs + except Exception: + # If we can't get scheduler config, use a safe default + _max_seqs = 1 if request.n is not None and request.n > _max_seqs: return self.create_error_response( f"n={request.n} exceeds max_num_seqs={_max_seqs}. "