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%.
@@ -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
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!',
})
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.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).
- 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.”
“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…”
“@tomchristie Thanks for hint! I will investigate this and tell you about the result.”
“I'm also seeing this issue and wanted to confirm that the PR from @euri10 fixes it for me.”
Failure Signature (Search String)
- (venv) C:\Users\vasiliy.pankov\Projects\uvicorn-lab>uvicorn --workers 2 server:app
Error Message
Stack trace
Error Message
-------------
(venv) C:\Users\vasiliy.pankov\Projects\uvicorn-lab>uvicorn --workers 2 server:app
[32mINFO[0m: Uvicorn running on [1mhttp://127.0.0.1:8000[0m (Press CTRL+C to quit)
[32mINFO[0m: Started parent process [[36m[1m13020[0m]
[32mINFO[0m: Started server process [[36m6888[0m]
[32mINFO[0m: Waiting for application startup.
[32mINFO[0m: ASGI 'lifespan' protocol appears unsupported.
[32mINFO[0m: Application startup complete.
[32mINFO[0m: Started server process [[36m19460[0m]
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 Message
-------------
(venv) PS C:\Users\vasiliy.pankov\Projects\uvicorn-lab> uvicorn --loop asyncio --workers 2 server:app
[32mINFO[0m: Uvicorn running on [1mhttp://127.0.0.1:8000[0m (Press CTRL+C to quit)
[32mINFO[0m: Started parent process [[36m[1m22292[0m]
[32mINFO[0m: Started server process [[36m13844[0m]
[32mINFO[0m: Waiting for application startup.
[32mINFO[0m: ASGI 'lifespan' protocol appears unsupported.
[32mINFO[0m: Application startup complete.
[32mINFO[0m: Started server process [[36m19548[0m]
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
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.
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.
When NOT to Use This Fix
- This fix is not applicable if running on non-Windows platforms or with a single worker.
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.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.