-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
Handling CTRL+C for websockets [linux] #333
Comments
Managed to get something that shuts down cleanly, including raising |
Also looking for a solution to this in the main branch. When dockerized, my app will not stop running if a socketio conneciton is open until I refresh the client to make the connection go away. Then it terminates. |
I have the same issue and have not found a good way to handle this yet. |
I have the same issue with HTTP streaming as opposed to websockets. Edit: This seems to really be an issue in Hypercorn — the blocking happens in
for sig in (signal.SIGINT, signal.SIGTERM):
asyncio.get_running_loop().add_signal_handler(sig, aborting.set)
|
I have the same problem and it started showing up after switching to python 3.12. After rolling back to 3.11 everything works fine. |
FWIW, the upstream issue is
python/cpython#123720
<python/cpython#123720 (comment)>
|
Using the minimal example websocket code the quart server hangs on CTRL+C until all clients have closed their connections.
This also applies to SSE examples.
app.py
client.py
The server should be closing all open websockets on SIGINT and allow the errors to propagate for cleanup.
I've been unable to find a nice solution to this. Currently manually adding a SIGINT handler to the current asyncio loop and calling
loop.close()
but that doesn't allow for nice cleanup.Environment:
The text was updated successfully, but these errors were encountered: