This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: telnetlib expect() and read_until() do not time out properly
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jackdied Nosy List: dgrisby, jackdied
Priority: normal Keywords: patch

Created on 2005-11-18 15:58 by dgrisby, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
telnetlib.patch dgrisby, 2005-11-18 15:58 Patch to telnetlib
Messages (3)
msg26901 - (view) Author: Duncan Grisby (dgrisby) Date: 2005-11-18 15:58
In telnetlib, expect() and read_until() take a timeout
argument. Unfortunately, the timeout is applied to each
individual socket read(), rather than applying a
deadline to the entire expect / read_until operation.
The result of this is that if a server trickles
non-matching data to the client, the expect() or
read_until() never times out. 

In the case of expect(), it keeps building a larger and
larger string of data to match with the regular
expressions, leading to the eventual death of the
process due to memory exhaustion.

I have attached a patch that means the timeouts occur
properly, and also adds a timeout to the initial
open()'s connect() call.
msg85034 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2009-04-01 16:20
assigning all open telnetlib items to myself
msg90965 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2009-07-26 22:55
this was fixed in r47215 (circa 2006).  Marking closed.
History
Date User Action Args
2022-04-11 14:56:14adminsetgithub: 42609
2009-07-26 22:55:33jackdiedsetstatus: open -> closed
resolution: fixed
messages: + msg90965
2009-04-01 16:20:25jackdiedsetassignee: jackdied

messages: + msg85034
nosy: + jackdied
2009-03-20 23:11:35ajaksu2setkeywords: + patch
stage: test needed
type: behavior
versions: + Python 2.6
2009-03-20 23:11:05ajaksu2linkissue1252001 dependencies
2005-11-18 15:58:28dgrisbycreate