Issue 19044: getaddrinfo raises near-useless exception (original) (raw)
Created on 2013-09-19 03:38 by nikratio, last changed 2022-04-11 14:57 by admin. This issue is now closed.
Messages (4)
Author: Nikolaus Rath (nikratio) *
Date: 2013-09-19 03:38
I received a bugreport for a Python application that contains the following stacktrace:
File "/usr/lib/python3.3/http/client.py", line 1057, in endheaders self._send_output(message_body) File "/usr/lib/python3.3/http/client.py", line 902, in _send_output self.send(msg) File "/usr/lib/python3.3/http/client.py", line 840, in send self.connect() File "/usr/lib/python3.3/http/client.py", line 1194, in connect self.timeout, self.source_address) File "/usr/lib/python3.3/socket.py", line 417, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): OSError: [Errno 0] Error
My guess is that something went wrong with the name resolution, but it seems near impossible to handle this in the application because apparently the exception contains no machine usable useful informaton at all.
It would be nice if whatever information Python used to determine that the getaddrinfo call failed could be included in the exception, so that it can be properly caught and handled.
Author: Ned Deily (ned.deily) *
Date: 2013-09-19 04:00
This looks like a platform bug. What platform was this running on? A web search turns up other reports of the system getaddrinfo() returning errno = 0 due to a glibc bug, for example, https://bugzilla.redhat.com/show_bug.cgi?id=958652.
Author: Balazs (balazs)
Date: 2013-09-20 08:31
Hi, this is the platform:
Linux cloudbackupbr 3.8.0-30-generic #44-Ubuntu SMP Thu Aug 22 20:52:24 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x6db033ec6858b391e114e252b3354ddbf5a9f7be, stripped
Thanks
Author: Charles-François Natali (neologix) *
Date: 2013-09-20 17:43
Well, as Ned explained, that's a libc bug. If getaddrinfo() fails with EAI_SYSTEM, errno should be set.
There's nothing more Python can do. If the error is reproducible, you can run the failing code with strace, to see what's going on (and check if there's a more recent glib version which could fix this bug).
History
Date
User
Action
Args
2022-04-11 14:57:51
admin
set
github: 63244
2013-09-20 17:43:43
neologix
set
status: open -> closed
resolution: not a bug
messages: +
stage: resolved
2013-09-20 08:31:26
balazs
set
messages: +
2013-09-19 07:54:55
balazs
set
nosy: + balazs
2013-09-19 06:25:37
pitrou
set
nosy: + neologix
2013-09-19 04:00:55
ned.deily
set
nosy: + ned.deily
messages: +
2013-09-19 03:38:52
nikratio
create