-
Notifications
You must be signed in to change notification settings - Fork 937
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
gaierror with socket.SOCK_CLOEXEC #944
Comments
Just to clarify, the repro script executes without issue if you comment out the call to monkey.patch_all() |
I'm guessing it's something like that too, but I have no way to try to reproduce this (the oldest Ubuntu I have is 14.04). Since 12.04 leaves support in a month, and since there is an easy, credible workaround (use the portable binary---which is what gevent is tested against anyway), and since this seems like a bug in a specific (old) platform, it doesn't seem to me that there's much gevent can or should try to do. Thanks for the report, it may help others find the workaround. |
Since I have access to Ubuntu 14.04 and the pypy binary claims to be for 12.04 and 14.04, I just tested there as well. Same issue. This was reported to me as a bug in PyMongo, which I'm going to close won't fix. Feel free to close this as well if you don't think it's worth investigating further. |
Since you can produce it on 14.04 I'll take a look there. I don't know if there's going to be anything we can do about it, it strikes me as a libc or pypy issue, but maybe we can file an upstream issue. |
Very interesting. This turns out to be an issue on any version/implementation of Python 2 that has the SOCK_CLOEXEC flag available. The versions of CPython 2.7 that ship with Ubuntu up through at least 16.04 don't seem to have this flag, so it can't happen there. First, if we use
(That traceback is supposed to be getting martialed across the threadpool that's used by default, so we shouldn't have to do this. I don't know why it isn't We can see that the At this point I tested CPython 3.5, which does have the SOCK_CLOEXEC flag available, but didn't cause the error. That's because it doesn't pass the extra parameters to
That doesn't seem right, though, shouldn't we need the type and protocol to be passed? So I went hunting through the CPython source code to determine how it dealt with those values. After a maze of twisty passages all alike (CPython goes to a great deal of trouble to avoid calling /* perform a name resolution */
memset(&hints, 0, sizeof(hints));
hints.ai_family = af;
Py_BEGIN_ALLOW_THREADS
ACQUIRE_GETADDRINFO_LOCK
error = getaddrinfo(name, NULL, &hints, &res); In other words, it's not passing the type and protocol. Python 2 does the same thing So gevent's Python 2 Thanks for the report! |
Well done! |
@echo off makes sure that the output is not cluttered. Otherwise it interferes with parsing the output, for example for version information. Comment lines in Windows BAT files are marked with REM, not with #
Description:
The following repro script demonstrates the problem.
The problem only happens when SOCK_CLOEXEC is defined. Using the pypy portable binary avoids the issue because it doesn't define SOCK_CLOEXEC. I'm guessing this is some weird bug with the libc version in Ubuntu 12.04.
What I've run:
The text was updated successfully, but these errors were encountered: