[BUG] WinError 10022 when run on Windows with workers > 1
See original GitHub issueThe error observed on Windows 10 with Python-3.6-amd64, Python-3.7-amd64, Python-3.8-amd64. Sample app:
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!',
})
OK when workers=1:
(venv) C:\Users\vasiliy.pankov\Projects\uvicorn-lab>uvicorn server:app
[32mINFO[0m: Started server process [[36m17728[0m]
[32mINFO[0m: Uvicorn running on [1mhttp://127.0.0.1:8000[0m (Press CTRL+C to quit)
[32mINFO[0m: Waiting for application startup.
[32mINFO[0m: ASGI 'lifespan' protocol appears unsupported.
[32mINFO[0m: Application startup complete.
[32mINFO[0m: Shutting down
[32mINFO[0m: Finished server process [[36m17728[0m]
WinError 10022 When workers > 1
(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)
File "c:\users\vasiliy.pankov\projects\uvicorn-lab\venv\lib\site-packages\uvicorn\main.py", line 386, in startup
server = await loop.create_server(
File "C:\Python\Python38\lib\asyncio\base_events.py", line 1469, in create_server
server._start_serving()
File "C:\Python\Python38\lib\asyncio\base_events.py", line 309, in _start_serving
sock.listen(self._backlog)
OSError: [WinError 10022] An invalid argument was supplied
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Python OSError: [WinError 10022] An invalid argument was ...
You are invoking accept method on client socket which is not set to passive mode by calling listen . Moreover, the socket is...
Read more >Trying to send self-created SYN packet and I face error ...
Hi, I'm learning about RAW packet creation in python. This is code from inc0x0.com that I have been working on. s = socket.socket(socket....
Read more >tiangolo/fastapi - Gitter
Hi guys, Im getting this error when im running the FastAPI app with uvicorn workers 2. Traceback (most recent call last):
Read more >OSError: [WinError 10022] An invalid argument was supplied
I am currently learning python, coming from java, and stumbled into an error I can't find the answer to. I am using the...
Read more >OSError: [WinError 10022] An invalid ... - Google Groups
The strangest thing is, that I got it to work when upgrading from 0.11 to 0.12, then I left my PC to get...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1 to fix from @euri10. Would be great to see this implemented.
Also running into this issue on Win10 dev machine and Windows Server 2016 LTS docker container target.