Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue35310

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:select which was interrupted by EINTR isn't re-run if the timeout has passed
Type:behaviorStage:resolved
Components:Versions:Python 3.8, Python 3.7, Python 3.6
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: Brian Maissy, miss-islington, oranav, vstinner
Priority:normalKeywords:patch

Created on2018-11-25 13:19 byBrian Maissy, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
select_eintr.pyBrian Maissy,2018-11-25 13:19
Pull Requests
URLStatusLinkedEdit
PR 10700closedoranav,2018-11-25 14:46
PR 10877mergedoranav,2018-12-03 20:53
PR 10948mergedmiss-islington,2018-12-05 20:36
PR 10949mergedmiss-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)*(Python committer)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)*(Python committer)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)*(Python committer)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)*(Python committer)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)*(Python committer)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
DateUserActionArgs
2022-04-11 14:59:08adminsetgithub: 79491
2018-12-05 23:17:30vstinnersetstatus: open -> closed
resolution: fixed
messages: +msg331191

stage: patch review -> resolved
2018-12-05 21:31:10miss-islingtonsetmessages: +msg331173
2018-12-05 21:29:10miss-islingtonsetnosy: +miss-islington
messages: +msg331172
2018-12-05 20:38:04vstinnersetmessages: +msg331161
2018-12-05 20:36:45miss-islingtonsetpull_requests: +pull_request10199
2018-12-05 20:36:32miss-islingtonsetpull_requests: +pull_request10198
2018-12-05 20:36:06vstinnersetmessages: +msg331158
2018-12-03 20:53:13oranavsetpull_requests: +pull_request10116
2018-11-27 11:02:10vstinnersetmessages: +msg330504
versions: - Python 3.5
2018-11-27 07:08:40Brian Maissysetnosy: +oranav
2018-11-27 07:07:29Brian Maissysetmessages: +msg330493
2018-11-26 21:17:36vstinnersetnosy: +vstinner
messages: +msg330464
2018-11-25 14:46:24oranavsetkeywords: +patch
stage: patch review
pull_requests: +pull_request9951
2018-11-25 13:22:50Brian Maissysetmessages: +msg330389
2018-11-25 13:19:06Brian Maissycreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp