-
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
File descriptors not inherited by child processes in python 3.4 #787
Comments
I created a branch to show a potential fix for the problem. This is a quick-and-dirty solution, I want to add unit tests, and check if this is the correct place to change fd inheritance. I'm also don't sure if the 'hasattr' method I use is the best way to find if we need to do this. |
Shouldn't we do it only if "close_fds" is False ? |
@thunderk I suspect we want to place this code in the sockets module, in the CircusSocket class immediatly after the fd is linked - where we set another flag already see https://github.com/mozilla-services/circus/blob/master/circus/sockets.py#L71 hasattr is fine I guess |
@tarekziade Thanks, I'll move the code there and open a pull request @k4nar I won't have access to "close_fds" after the move to sockets module. But I don't think it's a problem, inheritance was the default prior to 3.4 and close_fds should work regardless |
Fix file descriptor inheritance problem with python3.4 (#787)
Fix has been merged to master |
Hi everyone, I'm trying to run circus with python 3.4.1 and I'm getting this same error. [circus] [watcher:settings] [socket:settings] This is the output of "circusd circus.ini": (myenv)[root@server django]# circusd circus.ini And the same error occurs without --backend tornado |
I fix it adding the code in this page: https://github.com/mozilla-services/circus/pull/800/files |
There was an important change in python 3.4 that seems to break the usage of use_sockets.
Python 3.4 does not allow inheritance of newly created file descriptors to child processes by default : https://docs.python.org/3/whatsnew/3.4.html#whatsnew-pep-446
On linux, when using file descriptors for sockets, only fds 0 through 7 seems to be made available in child process.
I have a circus conf with 4 daemon watchers with use_sockets=True. The first 2 daemons get fd=6 and fd=7 and can open their socket and work with it. The last 2 daemons get fd=8 and fd=9 and get an exception on opening them :
The text was updated successfully, but these errors were encountered: