Gunicorn

Request persistence after platform timeout causes resource waste

warning
Resource ContentionUpdated Mar 1, 2026(via Exa)
Technologies:
How to detect:

When Heroku enforces the 30-second H12 Request Timeout, Gunicorn with Uvicorn workers continues executing the request in background. CPU and memory remain tied up in 'zombie' requests that can no longer reach the client, causing resource waste and potential cascading failures during high latency periods.

Recommended action:

Implement asyncio.wait_for with timeout slightly shorter than platform timeout (28 seconds for Heroku's 30s limit). Handle asyncio.CancelledError to clean up resources when Uvicorn cancels the task due to client disconnect. Ensure application logic is structured to respect asyncio.CancelledError and use truly asynchronous code with await statements.