Message320660
The bug is reproducible on Python 3.7. The connect call always fails when I
try to use connect to any IPv6 address with ProactorEventLoop.
The bug can be bypassed by adding "%0" to the IPv6 address. This will cause
to trigger this if construction:
https://github.com/python/cpython/blob/e76ac9d4ef77b74ea7de768f4de7c38893fad539/Lib/asyncio/base_events.py#L133
As mentioned by Sebastian, it happen because the _ipaddr_info function returns
only the host and the port for IPv6: return af, type, proto, '', (host, port)
https://github.com/python/cpython/blob/e76ac9d4ef77b74ea7de768f4de7c38893fad539/Lib/asyncio/base_events.py#L142
This (host, port) tuple used in ConnectEx call, but it expect 4-element tuple
to connect IPv6:
https://github.com/python/cpython/blob/55edd0c185ad2d895b5d73e47d67049bc156b654/Modules/overlapped.c#L1090
Instead it tries to connect, using IPv4 and fails.
The bug can be fixed by doing the following:
if af == socket.AF_INET6:
return af, type, proto, '', (host, port, 0, 0)
else:
return af, type, proto, '', (host, port)
instead of
return af, type, proto, '', (host, port)
in
https://github.com/python/cpython/blob/e76ac9d4ef77b74ea7de768f4de7c38893fad539/Lib/asyncio/base_events.py#L142 |
|
Date |
User |
Action |
Args |
2018-06-28 11:37:33 | bay | set | recipients:
+ bay, gvanrossum, gregory.p.smith, vstinner, yselivanov, sebastien.bourdeauducq |
2018-06-28 11:37:33 | bay | set | messageid: <1530185853.19.0.56676864532.issue27500@psf.upfronthosting.co.za> |
2018-06-28 11:37:33 | bay | link | issue27500 messages |
2018-06-28 11:37:33 | bay | create | |
|