#37035: Django stops serving requests after killing a task that took too long to
shut down
---------------------------------+-----------------------------------------
Reporter: inputvalidation | Type: Bug
Status: new | Component: HTTP handling
Version: 5.2 | Severity: Normal
Keywords: asgi | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+-----------------------------------------
I'm running a Django app with daphne like this:
daphne -e
ssl:${PORT}:interface=${ADDRESS}:privateKey=${KEY}:certKey=${CERT}
app.asgi:application
My app serves an endpoint which in turns calls an API, and that API is not
responding. daphne then warns with:
2026-04-15 07:26:58,035 WARNING Application instance <Task pending
name='Task-4092' coro=<ASGIHandler.call() running at
/opt/app/.env/lib64/python3.12/site-
packages/django/core/handlers/asgi.py:161> wait_for=<Future pending
cb=[shield.._outer_done_callback() at
/usr/lib64/python3.12/asyncio/tasks.py:922, Task.task_wakeup()]>> for
connection <WebRequest at 0x7f4f2b133720 method=GET uri=/slow-endpoint
clientproto=HTTP/1.1> took too long to shut down and was killed.
... but also stops serving any subsequent requests. I have to kill the
process - it hangs (unable to stop it with CTRL-C in terminal) and start
again. Is this a known issue or have I configured something incorrectly?
Reported this to the daphne project but then realized something appears to
be stuck in Django code.
Django version is 5.2.12, daphne version is 4.2.1, Twisted is at 25.5.0.
--
Ticket URL: <
https://code.djangoproject.com/ticket/37035>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.