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: test_debuglevel from test_telnetlib.py fails
Type: behavior Stage: commit review
Components: Tests Versions: Python 3.1, Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jackdied Nosy List: Arfrever, LinuxDonald, drukker, eric.smith, ezio.melotti, jackdied, mark.dickinson, pitrou, r.david.murray, rb09
Priority: high Keywords: buildbot, patch

Created on 2009-08-21 00:10 by LinuxDonald, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue6748.patch drukker, 2009-10-31 21:54
simplified_6748.diff jackdied, 2009-11-06 15:02
Messages (19)
msg91798 - (view) Author: Thomas Kowaliczek (LinuxDonald) Date: 2009-08-21 00:10
test test_telnetlib failed -- Traceback (most recent call last):
  File
"/home/LinuxDonald/Downloads/Python-3.1.1/Lib/test/test_telnetlib.py",
line 409, in test_debuglevel
    self._test_debuglevel([a, EOF_sigil], b)
  File
"/home/LinuxDonald/Downloads/Python-3.1.1/Lib/test/test_telnetlib.py",
line 389, in _test_debuglevel
    txt = telnet.read_all()
  File "/home/LinuxDonald/Downloads/Python-3.1.1/Lib/telnetlib.py", line
325, in read_all
    self.fill_rawq()
  File "/home/LinuxDonald/Downloads/Python-3.1.1/Lib/telnetlib.py", line
516, in fill_rawq
    buf = self.sock.recv(50)
socket.error: [Errno 104] Connection reset by peer
msg92219 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2009-09-03 20:42
I think this is fixed by r74638 but it never triggered on my box (Ubuntu
9.x) so I can't be sure.  What distro are you using?
msg92222 - (view) Author: Thomas Kowaliczek (LinuxDonald) Date: 2009-09-03 21:24
Fedora 11 64 Bit
msg93173 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2009-09-27 15:18
I can still reproduce this test failure after applying patch from
r74638. I use Gentoo ~amd64.
msg94768 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-10-31 21:38
This failure actually still happens quite regularly (on the buildbots
and also on my Mandriva system).

Judging from a quick Google search, errno 104 (ECONNRESET) should be
treated as a case of EOF (it means the TCP connection was reset using
RST rather than FIN, which apparently sometimes happens).

Besides, the test flow in test_telnetlib really is a mess (setUp and
tearDown getting called multiple times, for example), could you clean it up?
msg94769 - (view) Author: Derk Drukker (drukker) Date: 2009-10-31 21:54
This patch fixes the issue.
msg94770 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2009-10-31 22:07
I still get 'Connection reset by peer' on OS/X 10.5.8 with this patch
(http://bugs.python.org/file15242/issue6748.patch).
msg94771 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2009-10-31 22:21
Antoine Pitrou: Besides, the test flow in test_telnetlib really is a
mess (setUp and tearDown getting called multiple times, for example),
could you clean it up?

Yes, I'm working on refactoring the test server and separating out
testing that versus testing the telnetlib.  It is the test server (which
started simple and then grew cruft) which seems to have OS specific
problems.
msg94774 - (view) Author: Derk Drukker (drukker) Date: 2009-10-31 22:27
The change in the patch worked for me on py3k on Ubuntu 9.10.  It makes
sense, though, that it could still fail: conn can get closed too soon.
msg94790 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-11-01 16:23
Please note that the Windows buildbot shows another error:

======================================================================
ERROR: test_debuglevel (test.test_telnetlib.OptionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"E:\cygwin\home\db3l\buildarea\3.1.bolen-windows\build\lib\test\test_telnetlib.py",
line 409, in test_debuglevel
    self._test_debuglevel([a, EOF_sigil], b)
  File
"E:\cygwin\home\db3l\buildarea\3.1.bolen-windows\build\lib\test\test_telnetlib.py",
line 389, in _test_debuglevel
    txt = telnet.read_all()
  File
"E:\cygwin\home\db3l\buildarea\3.1.bolen-windows\build\lib\telnetlib.py", line
325, in read_all
    self.fill_rawq()
  File
"E:\cygwin\home\db3l\buildarea\3.1.bolen-windows\build\lib\telnetlib.py", line
516, in fill_rawq
    buf = self.sock.recv(50)
socket.error: [Errno 10053] An established connection was aborted by the
software in your host machine


According to a quick search on the Web, 10053 under Windows would be for
ECONNABORTED. Bazaar apparently faced the same issue:

https://lists.ubuntu.com/archives/bazaar/2006q4/020035.html
msg94971 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2009-11-06 14:32
Simplified tests attached.  Instead of bulking up and testing the TCP
server implementation I ended up mocking/stubing the socket recv/sendall
and select.select functions.  The only tests that use real sockets are
the ones to test timeouts.  Therefore test_telnetlib.py should be
platform neutral (let test_socket.py figure that stuff out).

Unless this blows up for anyone I'll check it in later today.
msg94973 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-11-06 14:53
With these test simplifications, it looks as though you could lose some
imports as well. (E.g., queue, os).

Patch works fine for me on 64-bit Linux.  I'll test it on OS X (10.5 and
10.6) when I get home tonight.
msg94974 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2009-11-06 15:02
ran pyflakes and removed unused imports.
msg94975 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2009-11-06 15:21
The new patch works for me on 32-bit OS X 10.5. I think the approach of
mocking the sockets is a good idea, although I haven't reviewed the
patch itself.
msg94976 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-11-06 15:44
The most recent patch (http://bugs.python.org/file15278) works for
me on OS X 10.4/PPC (32-bit), OS X 10.5/Intel (32-bit) and OS X 10.6/Intel 
(64-bit).
msg94983 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-11-06 17:15
The patch runs clean on my Gentoo buildbot, which otherwise fails
consistently.  I say apply it, I doubt you'd be making things worse by
doing so :)

Using minimal mocks with as few external dependencies as possible is
considered good unit-testing practice, from what I understand.
msg94985 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2009-11-06 17:21
committed in rev 76133
msg94995 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-11-06 19:27
Jack, this failure is happening also in 3.1.  I tried to merge the
revision, but there are too many differences between 3.x and 3.1 for me
to be confident that I'd get it right.  Could you do the backport, please?
msg95001 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2009-11-06 21:17
backported to maint via svnmerge in r76136.  3.1 and 3.x
test_telnetlib.py's (and telnetlib.py's) are now identical.
History
Date User Action Args
2022-04-11 14:56:52adminsetgithub: 50997
2009-11-06 21:17:29jackdiedsetstatus: open -> closed

messages: + msg95001
2009-11-06 19:27:15r.david.murraysetstatus: closed -> open

messages: + msg94995
2009-11-06 17:21:25jackdiedsetstatus: open -> closed
resolution: fixed
messages: + msg94985
2009-11-06 17:15:07r.david.murraysetpriority: normal -> high

nosy: + r.david.murray
messages: + msg94983

type: behavior
stage: commit review
2009-11-06 15:44:17mark.dickinsonsetmessages: + msg94976
2009-11-06 15:21:01eric.smithsetmessages: + msg94975
2009-11-06 15:02:37jackdiedsetfiles: - simplified_6748.diff
2009-11-06 15:02:13jackdiedsetfiles: + simplified_6748.diff

messages: + msg94974
2009-11-06 14:53:17mark.dickinsonsetnosy: + mark.dickinson
messages: + msg94973
2009-11-06 14:32:25jackdiedsetfiles: + simplified_6748.diff

messages: + msg94971
2009-11-06 02:49:39r.david.murraysetkeywords: + buildbot
2009-11-01 16:23:05pitrousetmessages: + msg94790
2009-10-31 22:28:00drukkersetmessages: + msg94774
2009-10-31 22:21:21jackdiedsetmessages: + msg94771
2009-10-31 22:07:10eric.smithsetnosy: + eric.smith
messages: + msg94770
2009-10-31 21:54:54drukkersetfiles: + issue6748.patch

nosy: + drukker
messages: + msg94769

keywords: + patch
2009-10-31 21:38:55pitrousetnosy: + pitrou

messages: + msg94768
versions: + Python 3.2
2009-10-31 21:19:14ezio.melottisetpriority: normal
nosy: + ezio.melotti
2009-09-27 15:18:17Arfreversetnosy: + Arfrever

messages: + msg93173
title: test test_telnetlib failed -> test_debuglevel from test_telnetlib.py fails
2009-09-03 21:24:09LinuxDonaldsetmessages: + msg92222
2009-09-03 20:42:58jackdiedsetassignee: jackdied

messages: + msg92219
nosy: + jackdied
2009-08-21 21:36:19rb09setnosy: + rb09
2009-08-21 00:10:33LinuxDonaldcreate