Jump to solution
Verify

The Fix

Upgrade to version 0.12.2 or later.

Based on closed Kludex/uvicorn issue #514 · 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
@@ -414,8 +414,19 @@ async def startup(self, sockets=None): # Explicitly passed a list of open sockets. # We use this when the server is run from a Gunicorn worker. + + def _share_socket(sock: socket) -> socket: + # Windows requires the socket be explicitly shared across
repro.py
async def app(scope, receive, send): assert scope['type'] == 'http' await send({ 'type': 'http.response.start', 'status': 200, 'headers': [ [b'content-type', b'text/plain'], ] }) await send({ 'type': 'http.response.body', 'body': b'Uvicorn is the best!', })
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.12.2 or later.\nWhen NOT to use: This fix is not applicable if running on non-Windows platforms or with a single worker.\n\n

Why This Fix Works in Production

  • Trigger: (venv) C:\Users\vasiliy.pankov\Projects\uvicorn-lab>uvicorn --workers 2 server:app
  • Mechanism: The issue arises from improper socket sharing across multiple worker processes on Windows
  • Why the fix works: Fixes the WinError 10022 issue when running Uvicorn with multiple workers on Windows by sharing sockets across processes. (first fixed release: 0.12.2).
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

  • Shows up under Python 3.7 in real deployments (not just unit tests).
  • The issue arises from improper socket sharing across multiple worker processes on Windows
  • Surfaces as: (venv) C:\Users\vasiliy.pankov\Projects\uvicorn-lab>uvicorn --workers 2 server:app

Proof / Evidence

  • GitHub issue: #514
  • Fix PR: https://github.com/kludex/uvicorn/pull/802
  • First fixed release: 0.12.2
  • 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.26

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“+1 to fix from @euri10. Would be great to see this implemented.”
@daddycocoaman · 2020-07-07 · source
“Could you confirm if this behaviour also replicates with --loop asyncio? Incidentally you really don't need to be using multiple worker *except* in production. A…”
@lovelydinosaur · 2019-12-09 · source
“@tomchristie Thanks for hint! I will investigate this and tell you about the result.”
@vopankov · 2019-12-10 · source
“I'm also seeing this issue and wanted to confirm that the PR from @euri10 fixes it for me.”
@wadedyck · 2020-04-01 · source

Failure Signature (Search String)

  • (venv) C:\Users\vasiliy.pankov\Projects\uvicorn-lab>uvicorn --workers 2 server:app

Error Message

Stack trace
error.txt
Error Message ------------- (venv) C:\Users\vasiliy.pankov\Projects\uvicorn-lab>uvicorn --workers 2 server:app INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) INFO: Started parent process [13020] INFO: Started server process [6888] INFO: Waiting for application startup. INFO: ASGI 'lifespan' protocol appears unsupported. INFO: Application startup complete. INFO: Started server process [19460] Process SpawnProcess-1: Traceback (most recent call last): File "C:\Python\Python38\lib\multiprocessing\process.py", line 313, in _bootstrap self.run() File "C:\Python\Python38\lib\multiprocessing\process.py", line 108, in run self._target(*self._args, **self._kwargs) File "c:\users\vasiliy.pankov\projects\uvicorn-lab\venv\lib\site-packages\uvicorn\subprocess.py", line 73, in subprocess_started target(sockets=sockets) File "c:\users\vasiliy.pankov\projects\uvicorn-lab\venv\lib\site-packages\uvicorn\main.py", line 341, in run loop.run_until_complete(self.serve(sockets=sockets)) File "C:\Python\Python38\lib\asyncio\base_events.py", line 608, in run_until_complete return future.result() File "c:\users\vasiliy.pankov\projects\uvicorn-lab\venv\lib\site-packages\uvicorn\main.py", line 358, in serve await self.startup(sockets=sockets) Fi ... (truncated) ...
Stack trace
error.txt
Error Message ------------- (venv) PS C:\Users\vasiliy.pankov\Projects\uvicorn-lab> uvicorn --loop asyncio --workers 2 server:app INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) INFO: Started parent process [22292] INFO: Started server process [13844] INFO: Waiting for application startup. INFO: ASGI 'lifespan' protocol appears unsupported. INFO: Application startup complete. INFO: Started server process [19548] Process SpawnProcess-2: Traceback (most recent call last): File "C:\Python\Python38\lib\multiprocessing\process.py", line 313, in _bootstrap self.run() File "C:\Python\Python38\lib\multiprocessing\process.py", line 108, in run self._target(*self._args, **self._kwargs) File "c:\users\vasiliy.pankov\projects\uvicorn-lab\venv\lib\site-packages\uvicorn\subprocess.py", line 73, in subprocess_started target(sockets=sockets) File "c:\users\vasiliy.pankov\projects\uvicorn-lab\venv\lib\site-packages\uvicorn\main.py", line 341, in run loop.run_until_complete(self.serve(sockets=sockets)) File "C:\Python\Python38\lib\asyncio\base_events.py", line 608, in run_until_complete return future.result() File "c:\users\vasiliy.pankov\projects\uvicorn-lab\venv\lib\site-packages\uvicorn\main.py", line 358, in serve await self.startup(s ... (truncated) ...

Minimal Reproduction

repro.py
async def app(scope, receive, send): assert scope['type'] == 'http' await send({ 'type': 'http.response.start', 'status': 200, 'headers': [ [b'content-type', b'text/plain'], ] }) await send({ 'type': 'http.response.body', 'body': b'Uvicorn is the best!', })

Environment

  • Python: 3.7

What Broke

Running Uvicorn with more than one worker results in a WinError 10022, causing server startup failures.

Why It Broke

The issue arises from improper socket sharing across multiple worker processes on Windows

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

Upgrade to version 0.12.2 or later.

When NOT to use: This fix is not applicable if running on non-Windows platforms or with a single worker.

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/802

First fixed release: 0.12.2

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 running on non-Windows platforms or with a single worker.

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.12.2 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.