The Fix
Upgrade to version 0.11.4 or later.
Based on closed Kludex/uvicorn issue #364 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -4,6 +4,7 @@
import multiprocessing
import os
+import signal
import sys
-------------------------------- live log call ---------------------------------
INFO test_statreload:test_statreload.py:109 number of process in container top: 3
INFO test_statreload:test_statreload.py:110 [['root', '201270', '201253', '15', '16:35', '?', '00:00:00', '/usr/local/bin/python /usr/local/bin/uvicorn app:app --host=0.0.0.0 --port=5000 --reload'], ['root', '201416', '201270', '2', '16:35', '?', '00:00:00', '/usr/local/bin/python -c from multiprocessing.semaphore_tracker import main;main(4)'], ['root', '201417', '201270', '8', '16:35', '?', '00:00:00', '/usr/local/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=5, pipe_handle=7) --multiprocessing-fork']]
INFO test_statreload:test_statreload.py:113 INFO: Uvicorn running on http://0.0.0.0:5000 (Press CTRL+C to quit)
INFO: Started reloader process [1]
INFO: Started server process [9]
INFO: Waiting for application startup.
INFO: ASGI 'lifespan' protocol appears unsupported.
INFO: Application startup complete.
PASSED
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\nUpgrade to version 0.11.4 or later.\nWhen NOT to use: This fix is not applicable if the application does not use the reloader.\n\n
Why This Fix Works in Production
- Trigger: docker-compose graceful shutdown of uvicorn --reload
- Mechanism: The reloader process does not handle SIGINT correctly, causing hangs during shutdown
- Why the fix works: Improves shutdown robustness when using `--reload` or multiprocessing in Docker containers. (first fixed release: 0.11.4).
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- The reloader process does not handle SIGINT correctly, causing hangs during shutdown
- Production symptom (often without a traceback): docker-compose graceful shutdown of uvicorn --reload
Proof / Evidence
- GitHub issue: #364
- Fix PR: https://github.com/kludex/uvicorn/pull/620
- First fixed release: 0.11.4
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.43
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Works well, and the implementation looks sound. Top effort @euri10. Would love to see this merged, docker test included or not, as the change is…”
“I think I got a fix on this branch, fancy trying it @gnat ? https://github.com/euri10/uvicorn/tree/docker_signal this was my inspiration after I read both excellent posts…”
“I'm seeing the same with a minimal docker-compose.yml: Run like: and then either ctrl+c or docker-compose stop from another terminal:”
“Add init: true to the service you are running unicorn under to forward the signals.”
Failure Signature (Search String)
- docker-compose graceful shutdown of uvicorn --reload
- When using "ctrl+c" and other ways to end the process it ends up just haning for the graceful shutdown periode and then it gets the SIGKILL because nothings happens.
Copy-friendly signature
Failure Signature
-----------------
docker-compose graceful shutdown of uvicorn --reload
When using "ctrl+c" and other ways to end the process it ends up just haning for the graceful shutdown periode and then it gets the SIGKILL because nothings happens.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
docker-compose graceful shutdown of uvicorn --reload
When using "ctrl+c" and other ways to end the process it ends up just haning for the graceful shutdown periode and then it gets the SIGKILL because nothings happens.
Minimal Reproduction
-------------------------------- live log call ---------------------------------
INFO test_statreload:test_statreload.py:109 number of process in container top: 3
INFO test_statreload:test_statreload.py:110 [['root', '201270', '201253', '15', '16:35', '?', '00:00:00', '/usr/local/bin/python /usr/local/bin/uvicorn app:app --host=0.0.0.0 --port=5000 --reload'], ['root', '201416', '201270', '2', '16:35', '?', '00:00:00', '/usr/local/bin/python -c from multiprocessing.semaphore_tracker import main;main(4)'], ['root', '201417', '201270', '8', '16:35', '?', '00:00:00', '/usr/local/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=5, pipe_handle=7) --multiprocessing-fork']]
INFO test_statreload:test_statreload.py:113 INFO: Uvicorn running on http://0.0.0.0:5000 (Press CTRL+C to quit)
INFO: Started reloader process [1]
INFO: Started server process [9]
INFO: Waiting for application startup.
INFO: ASGI 'lifespan' protocol appears unsupported.
INFO: Application startup complete.
PASSED
What Broke
Uvicorn hangs during shutdown in Docker, leading to SIGKILL after timeout.
Why It Broke
The reloader process does not handle SIGINT correctly, causing hangs during shutdown
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
Upgrade to version 0.11.4 or later.
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/kludex/uvicorn/pull/620
First fixed release: 0.11.4
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not applicable if the application does not use the reloader.
Verify Fix
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
- Pin production dependencies and upgrade only with a reproducible test that hits the failing path.
Version Compatibility Table
| Version | Status |
|---|---|
| 0.11.4 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.