[Python-bugs-list] [ python-Bugs-692988 ] test_timeout.py needs 'network' resource

SourceForge.net noreply@sourceforge.net
Wed, 26 Feb 2003 06:40:15 -0800


Bugs item #692988, was opened at 2003-02-25 13:01
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=692988&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Cesar Eduardo Barros (cesarb)
Assigned to: Nobody/Anonymous (nobody)
Summary: test_timeout.py needs 'network' resource

Initial Comment:
test_timeout.py fails in two tests if the network is
down. This is because it tries to connect to
www.google.com:80. It should be skipped unless the
'network' resource is enabled.

Also, the failure mode of the testConnectTimeout is
weird; it took 10 seconds for it to timeout. Maybe
that's a real bug somewhere.

The version I used is test_timeout.py revision 1.11

----------------------------------------------------------------------

>Comment By: Cesar Eduardo Barros (cesarb)
Date: 2003-02-26 11:40

Message:
Logged In: YES 
user_id=57799

Ah, and maybe the documentation should be updated to make
explicit that the connect() timeout does not include the DNS
lookup (and should not, since it's the _socket_ timeout...).
If you want a timeout in the DNS lookup, you must do the
lookup yourself (but I don't think it's really possible to
change the resolver timeout...)

----------------------------------------------------------------------

Comment By: Cesar Eduardo Barros (cesarb)
Date: 2003-02-26 11:37

Message:
Logged In: YES 
user_id=57799

testConnectTimeout is returning an error because it assumes
every socket.error is a timeout, when it could be, for
instance, a gaierror (which seems to be the case).

Also, the testcase is timing the whole socket.connect()
call, which includes both the DNS lookup and the connect()
proper. To avoid this, it should first do a lookup of
www.google.com by other means and pass the IP, not the
hostname, to the socket.connect() call. Else, it would be
also measuring the DNS resolution time (which can be kinda
long if the nameserver isn't local).

So, we have three problems in the testcase already:
1) It should only run the two remote tests when use of the
'network' resource is enabled
2) It should not assume that any socket.error is a timeout;
it must do more checks to make sure it's really a timeout
3) It should avoid measuring the time spent in
getaddrinfo(3) by resolving the hostname to an IP before
starting the tests (this would also avoid the false failures
because of DNS failure and make them look like a testcase
setup error).

Should I make a separate bug for each of these?

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-02-26 00:06

Message:
Logged In: YES 
user_id=33168

Whoops, sorry my last comment was meant for bug #692951. 
This report helps clarify the other bug.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-02-26 00:03

Message:
Logged In: YES 
user_id=33168

The first problem seems to be a DNS lookup failure
(www.google.com).  What Linux distro and version are you
using?  Did you enable ipv6?  Anything else that could help
debug this problem?  Many developers run on Linux and I
haven't heard of this problem?  Is your network very slow? 
Do you have a firewall which introduces large latencies?

----------------------------------------------------------------------

Comment By: Cesar Eduardo Barros (cesarb)
Date: 2003-02-25 13:08

Message:
Logged In: YES 
user_id=57799

Weird, the attachment didn't work. Trying again to attach
the file.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=692988&group_id=5470