-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
[FreeBSD, OSX] Socket module: incorrect usage of poll(2) #81992
Comments
FreeBSD implementation of poll(2) restricts timeout argument to be either zero, or positive, or equal to INFTIM (-1). Unless otherwise overridden, socket timeout defaults to -1. This value is then converted to milliseconds (-1000) and used as argument to the poll syscall. poll returns EINVAL (22), and the connection fails. I have discovered this bug during the EINTR handling testing, and have naturally found a repro code in https://bugs.python.org/issue23618 (see connect_eintr.py, attached). On GNU/Linux, the example runs as expected. |
I found an OS distinguishing behavior in https://github.com/python/cpython/blob/master/Modules/selectmodule.c#L603-L612 |
See Also: bpo-31334 |
Thanks Artem Khramov for the nice analysis of the root issue! And thanks for the fix! The bug is now fixed in 3.7, 3.8 and master branches. Python 2.7 is not affected: I added sock_call_ex() helper function in Python 3 when I implemeneted the PEP-475 (Retry system calls failing with EINTR). |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: