The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Fix in-flight request termination on SIGTERM when health-check runs in a separate process (#19427)
Alexsander Hamir5a0686865242
diff --git a/docker/prod_entrypoint.sh b/docker/prod_entrypoint.shindex 1fc09d2c864..28d1bdcc294 100644--- a/docker/prod_entrypoint.sh+++ b/docker/prod_entrypoint.sh@@ -2,6 +2,7 @@if [ "$SEPARATE_HEALTH_APP" = "1" ]; thenexport LITELLM_ARGS="$@"+ export SUPERVISORD_STOPWAITSECS="${SUPERVISORD_STOPWAITSECS:-3600}"exec supervisord -c /etc/supervisord.conffidiff --git a/docker/supervisord.conf b/docker/supervisord.confindex 877335804fe..ba9d99d18a5 100644--- a/docker/supervisord.conf+++ b/docker/supervisord.conf@@ -16,6 +16,7 @@ priority=1exitcodes=0stopasgroup=truekillasgroup=true+stopwaitsecs=%(ENV_SUPERVISORD_STOPWAITSECS)sstdout_logfile=/dev/stdoutstderr_logfile=/dev/stderrstdout_logfile_maxbytes = 0@@ -31,6 +32,7 @@ priority=2exitcodes=0stopasgroup=truekillasgroup=true+stopwaitsecs=%(ENV_SUPERVISORD_STOPWAITSECS)sstdout_logfile=/dev/stdoutstderr_logfile=/dev/stderrstdout_logfile_maxbytes = 0diff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.mdindex 53b0f3eea71..f76fd214682 100644--- a/docs/my-website/docs/proxy/config_settings.md+++ b/docs/my-website/docs/proxy/config_settings.md@@ -875,6 +875,7 @@ router_settings:| SECRET_MANAGER_REFRESH_INTERVAL | Refresh interval in seconds for secret manager. Default is 86400 (24 hours)| SEPARATE_HEALTH_APP | If set to '1', runs health endpoints on a separate ASGI app and port. Default: '0'.| SEPARATE_HEALTH_PORT | Port for the separate health endpoints app. Only used if SEPARATE_HEALTH_APP=1. Default: 4001.+| SUPERVISORD_STOPWAITSECS | Upper bound timeout in seconds for graceful shutdown when SEPARATE_HEALTH_APP=1. Default: 3600 (1 hour).| SERVER_ROOT_PATH | Root path for the server application| SEND_USER_API_KEY_ALIAS | Flag to send user API key alias to Zscaler AI Guard. Default is False| SEND_USER_API_KEY_TEAM_ID | Flag to send user API key team ID to Zscaler AI Guard. Default is Falsediff --git a/docs/my-website/docs/proxy/prod.md b/docs/my-website/docs/proxy/prod.mdindex 9216b0fbf30..a42d91a7d5f 100644--- a/docs/my-website/docs/proxy/prod.md+++ b/docs/my-website/docs/proxy/prod.md@@ -277,8 +277,13 @@ Set the following environment variable(s):```bashSEPARATE_HEALTH_APP="1" # Default "0"SEPARATE_HEALTH_PORT="8001" # Default "4001", Works only if `SEPARATE_HEALTH_APP` is "1"+SUPERVISORD_STOPWAITSECS="3600" # Optional: Upper bound timeout in seconds for graceful shutdown. Default: 3600 (1 hour). Only used when SEPARATE_HEALTH_APP=1.```+**Graceful Shutdown:**++Previously, `stopwaitsecs` was not set, defaulting to 10 seconds and causing in-flight requests to fail. `SUPERVISORD_STOPWAITSECS` (default: 3600) provides an upper bound for graceful shutdown, allowing uvicorn to wait for all in-flight requests to complete.+<video controls width="100%" style={{ borderRadius: '8px', marginBottom: '1em' }}><source src="https://cdn.loom.com/sessions/thumbnails/b08be303331246b88fdc053940d03281-1718990992822.mp4" type="video/mp4" />Your browser does not support the video tag.