Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinError 10022 - multiple workers #1545

Closed
marodev opened this issue Apr 3, 2019 · 3 comments
Closed

WinError 10022 - multiple workers #1545

marodev opened this issue Apr 3, 2019 · 3 comments

Comments

@marodev
Copy link

marodev commented Apr 3, 2019

Describe the bug
The Sanic server is in most of the attempts not able to start with multiple workers. Seems like the socket is not ready to bind and windows, therefore, throws an exception. This may be different on unix systems.

Code snippet
Sanic Hello World

from sanic import Sanic
from sanic.response import json

app = Sanic()


@app.route("/")
async def test(request):
    return json({"hello": "world"})


if __name__ == "__main__":
    app.run(host="127.0.0.1", port=8000, workers=2)

Expected behavior
Sanic starts and is ready to serve with multiple workers.

Environment

  • OS: Windows 10
  • Sanic: 19.3.1
  • Python 3.6

Additional context
[2019-04-03 10:16:32 +0200] [13992] [INFO] Goin' Fast @ http://127.0.0.1:8005

[2019-04-03 10:16:35 +0200] [11836] [ERROR] Unable to start server

Traceback (most recent call last):
File "lib\site-packages\sanic\server.py", line 745, in serve
http_server = loop.run_until_complete(server_coroutine)
File "Python36_64\Lib\asyncio\base_events.py", line 468, in run_until_complete
return future.result()
File "Python36_64\Lib\asyncio\base_events.py", line 1065, in create_server
sock.listen(backlog)

OSError: [WinError 10022] An invalid argument was supplied

[2019-04-03 10:16:35 +0200] [4444] [WARNING] Sanic tried to use loop.add_signal_handler but it is not implemented on this platform.

[2019-04-03 10:16:35 +0200] [4444] [INFO] Starting worker [4444]

@sjsadowski
Copy link
Contributor

This is a dupe of #1517 - as per the note there, window support is best effort and not guaranteed. While I'm leaving that open for review, I'm closing this one as redundant.

@marodev
Copy link
Author

marodev commented Apr 4, 2019

@sjsadowski Fair enough if you don’t want to support Windows. However, this should at least be mentioned somewhere in the docs!

@sjsadowski
Copy link
Contributor

@marodev Agreed, it should be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants