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
problem with siginterrupt #56433
Comments
If socket timeout > 0, then there is no way to automatically So a user may have to wrap every socket calls in this case. I found some related discussions in http://bugs.python.org/issue7978 |
Extract of manpage signal(7): "The following interfaces are never restarted after being interrupted by a signal handler, regardless of the use of SA_RESTART; they always fail with the error EINTR when interrupted by a signal handler:
Consider siginterrupt(signal, False) as a "best-effort" trick... which doesn't work with select(). If you don't want select() to be interrupted by SIGINT, use: pthread_sigmask(SIG_BLOCK, [SIGINT]); or pselect(...., [SIGINT]) pselect() is atomic, whereas pthread_sigmask+select is not. I added recently pthread_sigmask() to the signal module in Python 3.3. pselect() is not exposed in Python currently. We may add it if it's needed. -- If you really don't care of SIGINT, you can also ignore it completly using signal(SIGINT, SIG_IGN). |
Victor, I understand your response as saying that there is no bug, which would suggest closing this. Correct? If not, what is the requested action? |
Actually, it's part of a more general problem with EINTR being returned by many posix/socket module functions, see for example issue bpo-7978. |
siginterrupt(False) has no effect on select(). I listed some solutions to not interrupt select() on a signal (avoid completly EINTR). Issues bpo-7978 and bpo-9867 try the other solution, handle EINTR (retry select() on EINTR). I think that most users prefer the later (handle EINTR), so let's close as a duplicate. @zhiping Deng: Reopen the issue if you want the first solution :-) |
I think the problem is that after a user calles signal.siginterrupt(False), Or at least this should be documented in signal.siginterrupt(). |
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: