From f0b5ccf5f524981e5307db723aa486af5b4be9f3 Mon Sep 17 00:00:00 2001 From: Zilin Zhu Date: Sat, 15 Nov 2025 16:33:54 +0800 Subject: [PATCH] [RL] Allow bypassing /health check (#13320) --- python/sglang/srt/entrypoints/http_server.py | 6 ++++++ python/sglang/srt/environ.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/python/sglang/srt/entrypoints/http_server.py b/python/sglang/srt/entrypoints/http_server.py index c17db0bd1..460c5065a 100644 --- a/python/sglang/srt/entrypoints/http_server.py +++ b/python/sglang/srt/entrypoints/http_server.py @@ -420,6 +420,12 @@ async def health_generate(request: Request) -> Response: if _global_state.tokenizer_manager.server_status == ServerStatus.Starting: return Response(status_code=503) + if ( + not envs.SGLANG_ENABLE_HEALTH_ENDPOINT_GENERATION + and request.url.path == "/health" + ): + return Response(status_code=200) + sampling_params = {"max_new_tokens": 1, "temperature": 0.0} rid = f"HEALTH_CHECK_{time.time()}" diff --git a/python/sglang/srt/environ.py b/python/sglang/srt/environ.py index a91cc8e77..86936bccb 100644 --- a/python/sglang/srt/environ.py +++ b/python/sglang/srt/environ.py @@ -291,6 +291,9 @@ class Envs: # Warmup SGLANG_WARMUP_TIMEOUT = EnvFloat(-1) # in seconds. If a warmup forward batch takes longer than this, the server will crash to prevent hanging. Recommend to increase warmup timeout to 1800 to accommodate some kernel JIT precache e.g. deep gemm + # Health Check + SGLANG_ENABLE_HEALTH_ENDPOINT_GENERATION = EnvBool(True) + # fmt: on