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_urllibnet.test_bad_address() fails on Ubuntu 13.04
Type: behavior Stage:
Components: Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: barry, doko, ezio.melotti, javornikolov, pitrou, r.david.murray
Priority: normal Keywords:

Created on 2013-04-16 13:59 by barry, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (14)
msg187079 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2013-04-16 13:59
socket.gethostbyname('sadflkjsasf.i.nvali.d') gives a TimeoutError instead of an IOError on Ubuntu 13.04, causing the test to fail.

% ./python -m unittest test.test_urllibnet
.E../home/barry/projects/python/cpython/Lib/test/test_urllibnet.py:94: DeprecationWarning: FancyURLopener style of invoking requests is deprecated. Use newer urlopen functions/methods
  open_url = urllib.request.FancyURLopener().open(URL)
.........
======================================================================
ERROR: test_bad_address (test.test_urllibnet.urlopenNetworkTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/barry/projects/python/cpython/Lib/test/test_urllibnet.py", line 118, in test_bad_address
    socket.gethostbyname(bogus_domain)
TimeoutError: [Errno 110] Connection timed out

----------------------------------------------------------------------
Ran 13 tests in 6.116s

FAILED (errors=1)
msg187081 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2013-04-16 14:08
would be good to know if this is related to glibc-2.17, or not. There was a similiar issue ...
msg187095 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-04-16 15:26
I can't see how this could be classed as a bug in Python.  An invalid domain should quickly return a DNS error on a correctly configured operating system, which is what the test is testing.  If this report came from less well know names, I'd just close the issue as invalid....
msg187096 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2013-04-16 15:30
On Apr 16, 2013, at 03:26 PM, R. David Murray wrote:

>I can't see how this could be classed as a bug in Python.  An invalid domain
>should quickly return a DNS error on a correctly configured operating system,
>which is what the test is testing.  If this report came from less well know
>names, I'd just close the issue as invalid....

It may still be invalid (i.e. not a bug in Python), but I wanted to at least
record it in our tracker for reference.
msg187099 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-04-16 15:56
OK, that makes sense.  I leave it to you to close, I guess.
msg192586 - (view) Author: Yavor (javornikolov) Date: 2013-07-07 20:03
I have the same problem. Reproduced via custom app and what's failing is:

getaddrinfo("some.invalid.address.here", NULL, &hints, &result);

And it's failing quickly. But the returned error is system error 110 (Connection timed out).

* A virtual machine inside same host - with Centos 6.3: getaddrinfo returns -2 (invalid host address). This seems to be the behaviour expected by Python.
* VM with Ubuntu 13.04 (vanilla live CD) - again 110 (Connection timed out).

Since vanilla live CD is affected: I suppose it's not supposed to be something specific to my OS config.
msg192594 - (view) Author: Yavor (javornikolov) Date: 2013-07-07 21:10
* Up-to-date Arch Linux: -2 - Name or service not known
* Fedora Live CD: -2 - Name or service not known

These are in general with more recent libraries/packages than Ubuntu 13.04. All evidences suggest that there is something abnormal with this Ubuntu release.
msg192598 - (view) Author: Yavor (javornikolov) Date: 2013-07-07 21:57
Reported the issue to Ubuntu: https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1198744
msg192633 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2013-07-08 11:36
> ... that there is something abnormal with this Ubuntu release.

no, it is not.  This has nothing to do with Ubuntu, but is an upstream change introduced with glibc-2.17.  So you will see it on every system which is based on the glibc version.

see https://bugs.launchpad.net/bugs/1154599 for the complete discussion.
msg196161 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-08-25 20:41
Apparently this has been fixed upstream in glibc:
http://sourceware.org/bugzilla/show_bug.cgi?id=15339
There's also a related discussion at http://sourceware.org/bugzilla/show_bug.cgi?id=15726

Barry, can this be closed?
msg196162 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-08-25 20:56
Works here on 13.04.
msg196163 - (view) Author: Yavor (javornikolov) Date: 2013-08-25 21:15
Within this note https://sourceware.org/glibc/wiki/NameResolver about getaddrinfo():
"In case there was a *negative* answer it's unclear what should be returned."
msg196166 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-08-25 21:25
FTR this got "fixed" (i.e. the timeout is ignored) in 3.3 (b17662fc41af) and default (6f8fef208958), but on 2.7.
msg200284 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2013-10-18 17:20
I'm going to close this as invalid:

Python 3.3.2+ (3.3:247344a0d12e, Oct 18 2013, 13:14:59) 
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from socket import *
>>> gethostbyname('in.val.id')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.gaierror: [Errno -5] No address associated with hostname

Same goes for 2.7 and 3.4.
History
Date User Action Args
2022-04-11 14:57:44adminsetgithub: 61959
2013-10-18 17:20:40barrysetstatus: open -> closed
resolution: not a bug
2013-10-18 17:20:23barrysetmessages: + msg200284
2013-08-25 21:25:29ezio.melottisetmessages: + msg196166
2013-08-25 21:15:53javornikolovsetmessages: + msg196163
2013-08-25 20:56:00pitrousetnosy: + pitrou
messages: + msg196162
2013-08-25 20:41:44ezio.melottisetversions: + Python 2.7
nosy: + ezio.melotti

messages: + msg196161

type: behavior
2013-07-08 11:36:38dokosetmessages: + msg192633
2013-07-07 21:57:09javornikolovsetmessages: + msg192598
2013-07-07 21:10:19javornikolovsetmessages: + msg192594
2013-07-07 20:03:38javornikolovsetnosy: + javornikolov
messages: + msg192586
2013-04-16 15:56:45r.david.murraysetmessages: + msg187099
2013-04-16 15:30:15barrysetmessages: + msg187096
2013-04-16 15:26:48r.david.murraysetnosy: + r.david.murray
messages: + msg187095
2013-04-16 14:08:12dokosetmessages: + msg187081
2013-04-16 13:59:48barrycreate