-
Notifications
You must be signed in to change notification settings - Fork 257
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
Cannot specify socket as blocking #973
Conversation
Looks great! However, I wonder if there is a reason for this not being an option. @billygout : Did you try circus with blocking sockets ? |
Thanks for the quick response!
I also wonder if there's a reason for it not being an option :) Here are some potential reasons, I've come up with:
Sure, I tried circus with blocking sockets. I added the "blocking" feature in order to support a fastcgi binary, based on application that I use which expects a blocking socket. The application blows up when the socket is non-blocking, since, the library I'm using, libfcgi, doesn't retry when EWOULDBLOCK is returned by accept() (https://github.com/toshic/libfcgi/blob/master/libfcgi/os_unix.c#L1175-L1179). Note that even the simple server example including in circus changes the socket to blocking (https://github.com/circus-tent/circus/blob/master/examples/simplesocket_server.py#L10-L12). |
Wow, thanks for sharing those info :) . I'm all for it then, and adding it to the socket options seems to be the best way. However, I think that adding a small test case wouldn't hurt. I don't think it will be too hard. Also, could you update the doc? |
I'll do my best with a test case and the doc. Thanks On Thu, Apr 21, 2016 at 11:38 AM, Yannick PÉROUX notifications@github.com
|
@k4nar Added doc and test |
Great, thanks! |
sock = CircusSocket.load_from_config(config) | ||
self.assertEqual(sock.blocking, False) | ||
sock.bind_and_listen() | ||
fl = fcntl.fcntl(sock.fileno(), fcntl.F_GETFL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line doing anything? (also line133)
@ChaoticMind: Certainly not. Those two lines you mentioned were left over from my debugging. Feel free to clean it up. Thanks! |
The configuration for sockets support many options, but doesn't support specifying a socket as blocking or non-blocking. Suggest to add support for this as a new boolean field
blocking
.". For example:
This creates a blocking socket on port 8000. If the parameter is absent, it will assume the value of "false", in keeping with the current default behaviour.