Should server shutdown after receiving "lifespan.shutdown.failed"? #2298
Unanswered
peterschutt
asked this question in
Potential Issue
Replies: 1 comment 2 replies
-
Yes this was my intention with https://github.com/encode/starlette/pull/1227/files#diff-f974056c1286c773853f3083818ffe949dc1ff3724a10bc39025585c6c16c198R628 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If the shutdown failure message isn't initiated by the app receiving a "lifespan.shutdown" from uvicorn, then the app continues to run after the "lifespan.shutdown.failure" message is received.
Reproducer:
After the error occurs in the lifespan task, the app continues to serve:
Given that apps like starlette and litestar encourage use of the
lifespan
context for orchestration of things that should have a lifespan equivalent to the application object, then I think it would make sense for the app to stop if something has failed within that lifespan after the app has sent "startup.complete" but before the server has sent "shutdown" to the app.The spec seems to agree:
Beta Was this translation helpful? Give feedback.
All reactions