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

Unix sockets are not always passed to worker processes #2467

Closed
todddialpad opened this issue May 24, 2022 · 2 comments · Fixed by #2499
Closed

Unix sockets are not always passed to worker processes #2467

todddialpad opened this issue May 24, 2022 · 2 comments · Fixed by #2499

Comments

@todddialpad
Copy link

Describe the bug
If the server configuration includes the "unix" parameter to specify the path to a unix socket to open in the server, the socket is opened in the parent process but then not passed as the "sock" parameter to the worker processes.

Code snippet
Relevant source code, make sure to remove what is not necessary.

Expected behavior
Passing the unix parameter should result in the socket being opened in the parent process and then passed as an open file descriptor using the "sock" parameter to workers just like TCP/IP sockets are passed.

Environment (please complete the following information):

  • OS: Ubuntu linix
  • 22

Additional context
I believe it is simply a matter of a missing line here:

server_settings["unix"] = unix

of doing the same thing that the TCP case does

        server_settings["unix"] = None
        server_settings["sock"] = sock
@ahopkins
Copy link
Member

Thanks for reporting. I will double check the problem and suggested solution. 😎

@todddialpad
Copy link
Author

todddialpad commented May 30, 2022

Thanks @ahopkins . As a bit of additional information, the side effect that caused me to notice this is that when I run with multiple workers over a unix socket, all of the requests go to a single worker. The other workers just sit idle. This is because each worker winds up trying to itself open the unix path, and so overwriting each other and only the last worker has an actual open socket that the operating system knows about.

The workaround I am using is to manually open the unix socket and pass that socket (rather than the unix path) to the app.run method.

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

Successfully merging a pull request may close this issue.

2 participants