took too long to shut down and was killed
Closed this issue · 4 comments
You can't fix this bug for years, it still remains in new versions.
I'm using the latest version of asgi, django 5.1.1, daphne 4.1.2.
I am constantly plagued by these errors and the server is constantly dying.
[WARNING][daphne.server] Application instance <Task pending name='Task-4097' coro=<ASGIApp.call() running at /var/www/vision/.venv/lib/python3.10/site-packages/engineio/async_drivers/asgi.py:74> wait_for=<_GatheringFuture pending cb=[Task.task_wakeup()]>> for connection <WebRequest at 0x7f30f769a740 method=POST uri=/api/service/barrier/relay/jogging/ clientproto=HTTP/1.1> took too long to shut down and was killed.
[WARNING][daphne.server] Application instance <Task pending name='Task-538701' coro=<ASGIApp.call() running at /var/www/vision/.venv/lib/python3.10/site-packages/engineio/async_drivers/asgi.py:74> wait_for=<_GatheringFuture pending cb=[Task.task_wakeup()]>> for connection <WebRequest at 0x7ff069451ba0 method=POST uri=/api/service/tickets/ clientproto=HTTP/1.1> took too long to shut down and was killed.
reproduce:
https://github.com/jessamynsmith/daphne_hang/blob/main/README.md
The views in the example there aren't making any attempt to handle the task cancellation, or exit cleanly.
You should probably use async def
views for long running external calls, and then handle the cancellation as per the Django docs on handling disconnects.
uvicorn is working great. It doesn't have that problem.
Perhaps you could investigate the extra machinery it's using and make a suggestion? That would be great.
I'm going to close as a duplicate of django/channels#1119