Jump to solution
Verify

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%.

Jump to Verify Open PR/Commit
@@ -4,6 +4,7 @@ import multiprocessing import os +import signal import sys
repro.py
-------------------------------- 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
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
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).
Production impact:
  • 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…”
@gnat · 2019-12-11 · confirmation · source
“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…”
@euri10 · 2019-12-11 · source
“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:”
@sbv-trueenergy · 2019-06-17 · repro detail · source
“Add init: true to the service you are running unicorn under to forward the signals.”
@gnat · 2019-12-10 · source

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
signature.txt
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.txt
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

repro.py
-------------------------------- 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.

When NOT to use: This fix is not applicable if the application does not use the reloader.

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.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix is not applicable if the application does not use the reloader.

Verify Fix

verify
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

VersionStatus
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.