
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2018-11-25 13:19 byBrian Maissy, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| select_eintr.py | Brian Maissy,2018-11-25 13:19 | |||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 10700 | closed | oranav,2018-11-25 14:46 | |
| PR 10877 | merged | oranav,2018-12-03 20:53 | |
| PR 10948 | merged | miss-islington,2018-12-05 20:36 | |
| PR 10949 | merged | miss-islington,2018-12-05 20:36 | |
| Messages (10) | |||
|---|---|---|---|
| msg330388 -(view) | Author: Brian Maissy (Brian Maissy) | Date: 2018-11-25 13:19 | |
If a call to select.select() was interrupted by a signal and the select syscall set an errno of EINTR, then underPEP 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. | |||
| msg330389 -(view) | Author: Brian Maissy (Brian Maissy) | Date: 2018-11-25 13:22 | |
I believe the offending line in the source is this break statement:https://github.com/python/cpython/blob/master/Modules/selectmodule.c#L339 | |||
| msg330464 -(view) | Author: STINNER Victor (vstinner)*![]() | Date: 2018-11-26 21:17 | |
> Under this condition, either select() should be re-run with a timeout of 0, or the fd lists should be emptied before returning.What is the current behavior?Are you trying to fix a bug? | |||
| msg330493 -(view) | Author: Brian Maissy (Brian Maissy) | Date: 2018-11-27 07:07 | |
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. | |||
| msg330504 -(view) | Author: STINNER Victor (vstinner)*![]() | Date: 2018-11-27 11:02 | |
Ah! I missed attached select_eintr.py script. Ok, I reproduced the bug and I agree that it must be fixed. | |||
| msg331158 -(view) | Author: STINNER Victor (vstinner)*![]() | Date: 2018-12-05 20:36 | |
New changeset7f52415a6d4841d77d3b7853e83b25a22e0048dc by Victor Stinner (Oran Avraham) in branch 'master':bpo-35310: Clear select() lists before returning upon EINTR (GH-10877)https://github.com/python/cpython/commit/7f52415a6d4841d77d3b7853e83b25a22e0048dc | |||
| msg331161 -(view) | Author: STINNER Victor (vstinner)*![]() | Date: 2018-12-05 20:38 | |
Python 2.7 is not affected: select() isn't retried if it fails with EINTR. | |||
| msg331172 -(view) | Author: miss-islington (miss-islington) | Date: 2018-12-05 21:29 | |
New changesetb2e0649dd9a36d54478d0edb623a18d7379e6f19 by Miss Islington (bot) in branch '3.6':bpo-35310: Clear select() lists before returning upon EINTR (GH-10877)https://github.com/python/cpython/commit/b2e0649dd9a36d54478d0edb623a18d7379e6f19 | |||
| msg331173 -(view) | Author: miss-islington (miss-islington) | Date: 2018-12-05 21:31 | |
New changeset34510781901b75c9aeca79db41ce0fa92c67878f by Miss Islington (bot) in branch '3.7':bpo-35310: Clear select() lists before returning upon EINTR (GH-10877)https://github.com/python/cpython/commit/34510781901b75c9aeca79db41ce0fa92c67878f | |||
| msg331191 -(view) | Author: STINNER Victor (vstinner)*![]() | Date: 2018-12-05 23:17 | |
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 ;-) | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:08 | admin | set | github: 79491 |
| 2018-12-05 23:17:30 | vstinner | set | status: open -> closed resolution: fixed messages: +msg331191 stage: patch review -> resolved |
| 2018-12-05 21:31:10 | miss-islington | set | messages: +msg331173 |
| 2018-12-05 21:29:10 | miss-islington | set | nosy: +miss-islington messages: +msg331172 |
| 2018-12-05 20:38:04 | vstinner | set | messages: +msg331161 |
| 2018-12-05 20:36:45 | miss-islington | set | pull_requests: +pull_request10199 |
| 2018-12-05 20:36:32 | miss-islington | set | pull_requests: +pull_request10198 |
| 2018-12-05 20:36:06 | vstinner | set | messages: +msg331158 |
| 2018-12-03 20:53:13 | oranav | set | pull_requests: +pull_request10116 |
| 2018-11-27 11:02:10 | vstinner | set | messages: +msg330504 versions: - Python 3.5 |
| 2018-11-27 07:08:40 | Brian Maissy | set | nosy: +oranav |
| 2018-11-27 07:07:29 | Brian Maissy | set | messages: +msg330493 |
| 2018-11-26 21:17:36 | vstinner | set | nosy: +vstinner messages: +msg330464 |
| 2018-11-25 14:46:24 | oranav | set | keywords: +patch stage: patch review pull_requests: +pull_request9951 |
| 2018-11-25 13:22:50 | Brian Maissy | set | messages: +msg330389 |
| 2018-11-25 13:19:06 | Brian Maissy | create | |