[issue35310] select which was interrupted by EINTR isn't re-run if the timeout has passed

2018-11-25 Thread Brian Maissy


New submission from Brian Maissy :

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.

--
files: select_eintr.py
messages: 330388
nosy: Brian Maissy
priority: normal
severity: normal
status: open
title: select which was interrupted by EINTR isn't re-run if the timeout has 
passed
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file47945/select_eintr.py

___
Python tracker 
<https://bugs.python.org/issue35310>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35310] select which was interrupted by EINTR isn't re-run if the timeout has passed

2018-11-25 Thread Brian Maissy


Brian Maissy  added the comment:

I believe the offending line in the source is this break statement:
https://github.com/python/cpython/blob/master/Modules/selectmodule.c#L339

--

___
Python tracker 
<https://bugs.python.org/issue35310>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35310] select which was interrupted by EINTR isn't re-run if the timeout has passed

2018-11-26 Thread Brian Maissy


Brian Maissy  added the comment:

The current behavior is:

> select() is not retried, and the rlist is returned as-is (with fds in it 
> which are not ready for reading)

Yes, this is a bug. It results in select() indicating that fd are ready for 
reading when they, in fact, are not.

--

___
Python tracker 
<https://bugs.python.org/issue35310>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35310] select which was interrupted by EINTR isn't re-run if the timeout has passed

2018-11-26 Thread Brian Maissy


Change by Brian Maissy :


--
nosy: +oranav

___
Python tracker 
<https://bugs.python.org/issue35310>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com