Issue 14635: telnetlib uses select instead of poll - limited to FD_SETSIZE fds (original) (raw)

Created on 2012-04-20 19:20 by gregory.p.smith, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
telnet_expect_read_until_using_poll akintayo,2012-05-31 21:06 Use select.poll() to implement telnet.read_until and telnet.expect review
Messages (14)
msg158874 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2012-04-20 19:20
telnetlib uses select.select. This limits it to being able to work when file descriptors are still below FD_SETSIZE (often 1024) meaning it can't be used in some large programs today. It should use poll. (it is probably easy to fix this and the telnetlib EINTR at the same time)
msg158889 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2012-04-20 20:47
See also issue #10527, dealing with multiprocessing. Note that this probably affects other modules besides telnetlib, so it might be interesting to find a way to factorize code (i.e. use poll() if available or fallback to select()).
msg158894 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-04-20 21:57
Out of curiosity, are you reporting this because you ran into it in your code? I was not aware that telnet was still in real use.
msg158916 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-04-21 12:21
> Note that this probably affects other modules besides telnetlib, so it > might be interesting to find a way to factorize code (i.e. use poll() > if available or fallback to select()). asyncore might have been the answer.
msg159045 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-23 16:52
Éric: there are devices that still only allow telnet. Older cisco routers (*many* of which are still in the field) are just one example I'm familiar with. I don't currently have any tools that use telnetlib to talk to them, but I've got at least two I'd like to find time to write...and I can easily imagine this limitation coming up as a real issue at Google :)
msg162020 - (view) Author: Akintayo Holder (akintayo) Date: 2012-05-31 21:06
Hi, telnet.read_until() and telnet.expect() will use select.poll() instead of select.select() on systems where poll() is available. The patch also includes updates to test_telnetlib, the read_until() tests were changed to test the case where poll() is unavailable. We also added unit tests for expect(), these are a copy of the read_until() tests. This patch is against 2.7. Akintayo
msg162490 - (view) Author: Akintayo Holder (akintayo) Date: 2012-06-07 19:35
Is my approach ok or is the plan to follow neologix's suggestion and make one fix that works for all the select.select issues.
msg162499 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2012-06-07 21:01
I think your approach is fine. BTW for anyone who wants to chase the larger idea of dealing with all select.select use, take a look at the prototype for a select.select() implemented using poll.poll() that I just put in http://bugs.python.org/issue15032.
msg165568 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2012-07-16 05:17
looking at this now. 2.7 commit first; then i'll forward port to 3.2/3.3.
msg165569 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-07-16 05:17
New changeset c53e3aacb816 by Gregory P. Smith in branch '2.7': Fixes Issue #14635: telnetlib will use poll() rather than select() when possible http://hg.python.org/cpython/rev/c53e3aacb816
msg165574 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-07-16 06:45
New changeset de229dde486b by Gregory P. Smith in branch '3.2': Fixes Issue #14635: telnetlib will use poll() rather than select() when possible http://hg.python.org/cpython/rev/de229dde486b New changeset 558e5ed678c3 by Gregory P. Smith in branch 'default': Fixes Issue #14635: telnetlib will use poll() rather than select() when possible http://hg.python.org/cpython/rev/558e5ed678c3
msg165650 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-07-16 19:27
This broke the buildbots without poll() (Windows).
msg165665 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2012-07-16 23:10
Those should all be fixed as of my most recent commit.
msg205877 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-12-11 02:26
New changeset d61e8050b7d7 by Gregory P. Smith in branch '2.7': Fixes Issue #17200: telnetlib's read_until and expect timeout was broken by the http://hg.python.org/cpython/rev/d61e8050b7d7 New changeset 46186736e91c by Gregory P. Smith in branch '3.3': Fixes Issue #17200: telnetlib's read_until and expect timeout was broken by the http://hg.python.org/cpython/rev/46186736e91c
History
Date User Action Args
2022-04-11 14:57:29 admin set github: 58840
2013-12-11 02:26:26 python-dev set messages: +
2012-07-16 23:10:38 gregory.p.smith set messages: +
2012-07-16 19:27:44 pitrou set messages: +
2012-07-16 06:58:05 gregory.p.smith set status: open -> closedresolution: fixedstage: resolved
2012-07-16 06:45:00 python-dev set messages: +
2012-07-16 05:17:54 python-dev set nosy: + python-devmessages: +
2012-07-16 05:17:16 gregory.p.smith set assignee: jackdied -> gregory.p.smithmessages: +
2012-06-07 21:01:26 gregory.p.smith set messages: +
2012-06-07 19:35:15 akintayo set messages: +
2012-05-31 21:06:26 akintayo set files: + telnet_expect_read_until_using_pollnosy: + akintayomessages: +
2012-04-23 16:52:48 r.david.murray set nosy: + r.david.murraymessages: +
2012-04-21 12:21:09 pitrou set nosy: + pitroumessages: +
2012-04-20 21:57:54 eric.araujo set nosy: + eric.araujomessages: +
2012-04-20 20:47:53 neologix set nosy: + neologixmessages: +
2012-04-20 19:20:23 gregory.p.smith create