Shutdown immediately closes websocket connections without grace #2552
Unanswered
tonyay163
asked this question in
Potential Issue
Replies: 1 comment 2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using uvicorn with fastapi. On SIGTERM, I can see that existing websocket connections are closed with 1012 which comes from uvicorn. This seems to differ from all the other request types where they are allowed to drain. Is there a way I can allow a graceful timeout for these connections instead of killing them abruptly?
Dependencies:
Code:
Repro:
uvicorn main:app --host 0.0.0.0 --port 8080
python main.py
Logs:
As you can see in the logs, the HTTP request finishes gracefully before the server shutdown but it kills the websocket connection immediately.
Beta Was this translation helpful? Give feedback.
All reactions