-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
web.run_app(): Terminate properly with signal TERM and INT #1932
Labels
Comments
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Long story short
This is more or less related to #63. My issue is that
web.run_app()
gracefully exit when SIGINT is sent to the process but not when SIGTERM is sent.This is because
web.run_app()
catches SIGINT (withKeyboardInterrupt
exception) but does not override SIGTERM handling (there is no exception raised for that, one can only usesignal.signal
). Most of the time it is SIGTERM that is used to gracefully shutdown a process but that will actually kill the application instead of letting the requests finish properly and response.kill
, Docker and system.d use SIGTERM by default.Expected behaviour
I suppose the default expected behavior of
web.run_app()
is to allow the requests to be finished before terminating the process. That's what most people would think it does. The feeling is also harder since it does it already for SIGINT.Actual behaviour
Only SIGINT triggers a graceful exit. SIGTERM does not let the running requests finish.
Steps to reproduce
Your environment
Python 3.6, Arch Linux
The text was updated successfully, but these errors were encountered: