From ca571025f591656fba682c7fa6be1a17609704e4 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Mon, 10 Mar 2025 20:03:14 +0000 Subject: [PATCH] fix: Enable lifespan=on for uvicorn Default behavior is "auto", meaning it will try lifespan, but if something goes wrong, it will silently swallow the issue and won't use the lifespan handler at all. This default behavior resulted in silently breaking shutdown handlers for providers. With this patch, server will fail to start next time something gets borked in the middleware layer, which is good. Related: #188 Signed-off-by: Ihar Hrachyshka --- llama_stack/distribution/server/server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/llama_stack/distribution/server/server.py b/llama_stack/distribution/server/server.py index c92903228..8952762d2 100644 --- a/llama_stack/distribution/server/server.py +++ b/llama_stack/distribution/server/server.py @@ -418,6 +418,7 @@ def main(): "app": app, "host": listen_host, "port": port, + "lifespan": "on", } if ssl_config: uvicorn_config.update(ssl_config)