-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
select which was interrupted by EINTR isn't re-run if the timeout has passed #79491
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
Comments
If a call to select.select() was interrupted by a signal and the select syscall set an errno of EINTR, then under PEP-475 the select call should be re-executed. If, however, there is a signal handler which takes enough time that the select's timeout expires, select() is not retried, and the rlist is returned as-is (with fds in it which are not ready for reading). Under this condition, either select() should be re-run with a timeout of 0, or the fd lists should be emptied before returning. Example code which reproduces the problem attached. |
I believe the offending line in the source is this break statement: |
What is the current behavior? Are you trying to fix a bug? |
The current behavior is:
Yes, this is a bug. It results in select() indicating that fd are ready for reading when they, in fact, are not. |
Ah! I missed attached select_eintr.py script. Ok, I reproduced the bug and I agree that it must be fixed. |
Python 2.7 is not affected: select() isn't retried if it fails with EINTR. |
Ok, the bug should now be fixed in 3.6, 3.7 and master branches. Thanks Brian Maissy for the bug report and thanks Oran Avraham for the fix! I hope that we will understand why I didn't want to add a new functional test ;-) |
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: