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

Fix windows 1022 error using multiple workers #802

Merged
merged 1 commit into from Oct 12, 2020

Conversation

euri10
Copy link
Member

@euri10 euri10 commented Oct 6, 2020

Fixes #514 shamelessly inspired by hypercorn
Fixes #683 also

@euri10 euri10 requested a review from a team October 7, 2020 08:56
Copy link
Member

@cdeler cdeler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be I'm a newby, but I had to dig inside cpython source and msdn to realize why it works.

Specifying --workers <int> we enforce the server to use multiple workers processes spawning child processes. It's like a "pre-fork" mode, used, for example, by Apache web server: several child processes handles the same server socket. Unlike in *nix, the only way to share a socket between processes in Win is WSADuplicateSocket, called by sock.share().

It's what the PR did.

Let me left it there, just for the history :-)

Approved

@euri10 euri10 merged commit 103167a into encode:master Oct 12, 2020
@euri10
Copy link
Member Author

euri10 commented Oct 12, 2020

Let me left it there, just for the history :-)

history thank you ! pretty amazing explanation, I didn't know all that

@euri10 euri10 deleted the 514_win1022_error branch October 12, 2020 06:55
@bobfang1992
Copy link

When will this be released? Thanks!

@cdeler
Copy link
Member

cdeler commented Oct 19, 2020

@bobfang1992 here is the release

#823

@bobfang1992
Copy link

awesome.

@qqletter
Copy link

qqletter commented Jun 6, 2023

I get the same error when use multiple workers on win11(22H2) and uvicorn 0.22.0

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

Successfully merging this pull request may close these issues.

Invalid argument was supplied error on windows [BUG] WinError 10022 when run on Windows with workers > 1
4 participants