Author vstinner
Recipients Evan.Teran, giampaolo.rodola, loewis, pitrou, schmir, vstinner
Date 2012-12-31.01:10:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I spoke with schmir on IRC about this issue because he considers the request as valid, and he doesn't understand why the issue was closed with "wont fix".


schmir use case:

 - a network where IPv6 doesn't work (for an unknown reason)
 - a Linux system with IPv6 support and a network interface with a local link address (fe80:...), maybe also with a IPv6 public address (it doesn't really matter for the use case)
 - Python configured with --disable-ipv6 "to ensure that Python will not send any IPv6 request" (according to schmir) (./configure --disable-ipv6)
 - the DNS client is configured to return IPv4 addresses and then IPv6 addresses
 - call socket.create_connection((hostname, 80))
 - the computer cannot connect to this host in IPv4 nor IPv6

Current behaviour:

 - Python calls getaddrinfo() with ai_family=0 (AF_UNSPEC)
 - the DNS client (of the glibc) asks for A (IPv4) and AAAA (IPv6) DNS records
 - Python tries to connect to the IPv4 address and fails (connection error for example)
 - Python tries to connect to the IPv6 address and fails with a TypeError because AF_INET6 is not supported
 - the final exception is misleading: TypeError instead of a connection error

schmir expects that --disable-ipv6 would "really" disable IPv6 *everywhere* in Python, which is wrong. Python may still get IPv6 adddresses from getaddrinfo() if the system does somehow support IPv6.

schmir proposes the change create_connection() to really disable IPv6 there: force AF_INET if socket.has_ipv6 is False.

I agree that something is wrong here, but I also disagree with schmir. In my opinion, --disable-ipv6 is the wrong answer to the initial problem (ensure that the computer will not use IPv6 because IPv6 doesn't work somewhere in the network). The correct solution is to disable IPv6 system wide. See for example to disable IPv6 system wide on Linux.

It's simpler and safer to disable IPv6 system wide instead of fixing all applications. Other applications will have the same issue (ask AAAA DNS records) in the same use case.

"wont fix" is the correct status for this issue: we agree that there is a bug, but it will not be fixed, because --disable-ipv6 is the wrong solution.


Note: ai_flags=AI_ADDRCONFIG would not change anything because the network interface has an IPv6 local link address. See for a discussion about this in the glibc.

Note: schmir uses Gentoo and disabled the ipv6 use flag of its python package (USE=-ipv6).
Date User Action Args
2012-12-31 01:10:54vstinnersetrecipients: + vstinner, loewis, pitrou, giampaolo.rodola, schmir, Evan.Teran
2012-12-31 01:10:54vstinnersetmessageid: <>
2012-12-31 01:10:54vstinnerlinkissue7735 messages
2012-12-31 01:10:53vstinnercreate