Opened 4 hours ago

Closed 3 hours ago

#37035 closed Bug (invalid)

Django stops serving requests after killing a task that took too long to shut down

Reported by: inputvalidation Owned by:
Component: HTTP handling Version: 5.2
Severity: Normal Keywords: asgi
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (1)

comment:1 by Jacob Walls, 3 hours ago

Resolution: invalid
Status: newclosed

Hi, thanks for the report, but you haven't provided a reproducer that demonstrates Django is at fault. For help, try first TicketClosingReasons/UseSupportChannels.

Note: See TracTickets for help on using tickets.
Back to Top