Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 not necessarly present if socket.AF_INET6 is defined #2104

Closed
cecton opened this issue Jul 17, 2017 · 4 comments
Closed

IPv6 not necessarly present if socket.AF_INET6 is defined #2104

cecton opened this issue Jul 17, 2017 · 4 comments
Labels

Comments

@cecton
Copy link
Contributor

cecton commented Jul 17, 2017

Long story short

Was trying to run the test on Python 3.5 and failed because I don't have IPv6 in a Docker container by default and the test thought I had.

root@bbbf05804213:/src# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
22: eth0@if23: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.2/16 scope global eth0
       valid_lft forever preferred_lft forever
root@bbbf05804213:/src# python
Python 3.5.3 (default, Jul  8 2017, 05:09:47) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.AF_INET6
<AddressFamily.AF_INET6: 10>

Expected behaviour

Use IPv4 if IPv6 is not present.

Actual behaviour

According to the doc:

If the AF_UNIX constant is not defined then this protocol is unsupported.

This probably means that the CPython has been compiled with IPv6, not that all the network interfaces have it.

Steps to reproduce

# in aiohttp source directory
$ docker run -it --rm -v $PWD:/src -w /src python:3.5 /bin/bash
$ pip install tox
$ tox -e py35 -- -x tests/test_run_app.py

Your environment

Python 3.5.3, Docker 17.05.0-ce build 89658bed64

@cecton
Copy link
Contributor Author

cecton commented Jul 17, 2017

My bad... it seems the code responsible is on asyncio.

@cecton cecton closed this as completed Jul 17, 2017
@cecton
Copy link
Contributor Author

cecton commented Jul 17, 2017

Actually we can fix it by replacing the hostname of the server (localhost) by the IPv4 address (127.0.0.1). Would it be an acceptable fix for you?

https://github.com/aio-libs/aiohttp/blob/master/tests/test_run_app.py#L264

@cecton cecton reopened this Jul 17, 2017
@cecton
Copy link
Contributor Author

cecton commented Jul 25, 2017

Fixed by #2105 but will also be fixed on asyncio at some point http://bugs.python.org/issue30945

@cecton cecton closed this as completed Jul 25, 2017
@lock
Copy link

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant