-
-
Notifications
You must be signed in to change notification settings - Fork 753
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
CTRL^C doesn't work while startup in progress #1301
Comments
This happens to me too. This is my solution: def receive_signal(signalNumber, frame):
print('Received:', signalNumber)
sys.exit()
@app.on_event("startup")
async def startup_event():
import signal
signal.signal(signal.SIGINT, receive_signal)
# startup tasks |
This is probably a reasonable behaviour? I'd assume that a sensible approach would be that we always allow the startup to run to completion, but then exit (and run shutdown) if we've been interrupted. |
@tomchristie Hi, I'm having this problem. Imagine you had the wrong config and need to stop the program ASAP. Ctrl-C is mainly for development, where you can't discard a mistake or just a test of a while True: pass. With this, devs are forced to use htop or the task manager to end python. |
the problem is that the thing the application may be doing on startup, is downloaing a giant file. I was launching ialacol's uvicorn server, and on startup it began downloading a 4GB LLM checkpoint. the default model wasn't one I wished to use, so I tried to interrupt it in order to change the CLI args. |
Checklist
master
.Describe the bug
Hi!
ctrl^c doesn't work until on_startup function completes. This happens because install_signal_handlers call before startup
Steps to reproduce the bug
Expected behavior
No response
Actual behavior
No response
Debugging material
No response
Environment
uvicorn - 0.16.0
python - 3.8.6
Additional context
No response
Important
The text was updated successfully, but these errors were encountered: