Issue27500
Created on 2016-07-12 17:55 by sebastien.bourdeauducq, last changed 2019-01-15 12:24 by sebastien.bourdeauducq. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 7993 | merged | yselivanov, 2018-06-28 17:01 | |
| PR 8000 | merged | miss-islington, 2018-06-29 02:00 | |
| PR 8001 | merged | miss-islington, 2018-06-29 02:01 | |
| Messages (11) | |||
|---|---|---|---|
| msg270258 - (view) | Author: Sebastien Bourdeauducq (sebastien.bourdeauducq) * | Date: 2016-07-12 17:55 | |
The following code fails with "OSError: [WinError 10022] An invalid argument was supplied".
import asyncio
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(loop)
loop.run_until_complete(asyncio.open_connection("::1", 4242))
This is a regression in 3.5.2. 3.5.1 does not have this bug. Connecting to 127.0.0.1 does not cause the problem.
|
|||
| msg270263 - (view) | Author: Sebastien Bourdeauducq (sebastien.bourdeauducq) * | Date: 2016-07-12 18:46 | |
The first offending commit is this one: https://github.com/python/cpython/commit/03df54d549173e17e1cf9a767199de32a363aa6b more specifically "return af, type, proto, '', (host, port)". For IPv6, it should be "(host, port, flow info, scope id)" instead of just "(host, port)". |
|||
| msg288712 - (view) | Author: Sebastien Bourdeauducq (sebastien.bourdeauducq) * | Date: 2017-02-28 12:35 | |
This is still a problem with Python 3.5.3 and 3.6.0. |
|||
| msg317997 - (view) | Author: Sebastien Bourdeauducq (sebastien.bourdeauducq) * | Date: 2018-05-29 09:28 | |
Any chance someone could look into this bug? |
|||
| msg320660 - (view) | Author: bay (bay) | Date: 2018-06-28 11:37 | |
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 |
|||
| msg320675 - (view) | Author: Guido van Rossum (gvanrossum) * | Date: 2018-06-28 16:42 | |
Somebody please submit a PR so this can be fixed in 3.7.1 and the fix can be backported to 3.6.7. |
|||
| msg320676 - (view) | Author: Yury Selivanov (yselivanov) * | Date: 2018-06-28 17:05 | |
> Somebody please submit a PR so this can be fixed in 3.7.1 and the fix can > be backported to 3.6.7. Somehow I overlooked this one when I was sifting the issues we needed to fix in 3.7. I've opened a PR. |
|||
| msg320693 - (view) | Author: Yury Selivanov (yselivanov) * | Date: 2018-06-29 01:59 | |
New changeset d904c238ca3551750cb97d15d827c3e525970867 by Yury Selivanov in branch 'master': bpo-27500: Fix static version of getaddrinfo to resolve IPv6 (GH-7993) https://github.com/python/cpython/commit/d904c238ca3551750cb97d15d827c3e525970867 |
|||
| msg320694 - (view) | Author: miss-islington (miss-islington) | Date: 2018-06-29 02:16 | |
New changeset 3ed44141216aa1d2d8dd7d170c2dc216a6e718b6 by Miss Islington (bot) in branch '3.7': bpo-27500: Fix static version of getaddrinfo to resolve IPv6 (GH-7993) https://github.com/python/cpython/commit/3ed44141216aa1d2d8dd7d170c2dc216a6e718b6 |
|||
| msg320695 - (view) | Author: miss-islington (miss-islington) | Date: 2018-06-29 02:22 | |
New changeset c00144cd7741a5060662e85717f6559ad46d02aa by Miss Islington (bot) in branch '3.6': bpo-27500: Fix static version of getaddrinfo to resolve IPv6 (GH-7993) https://github.com/python/cpython/commit/c00144cd7741a5060662e85717f6559ad46d02aa |
|||
| msg333692 - (view) | Author: Sebastien Bourdeauducq (sebastien.bourdeauducq) * | Date: 2019-01-15 12:24 | |
Thank you! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-01-15 12:24:02 | sebastien.bourdeauducq | set | messages: + msg333692 |
| 2019-01-15 12:13:50 | vstinner | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2018-06-29 02:22:42 | miss-islington | set | messages: + msg320695 |
| 2018-06-29 02:16:50 | miss-islington | set | nosy:
+ miss-islington messages: + msg320694 |
| 2018-06-29 02:01:42 | miss-islington | set | pull_requests: + pull_request7608 |
| 2018-06-29 02:00:52 | miss-islington | set | pull_requests: + pull_request7607 |
| 2018-06-29 01:59:43 | yselivanov | set | messages: + msg320693 |
| 2018-06-28 17:05:12 | yselivanov | set | priority: normal -> high messages: + msg320676 |
| 2018-06-28 17:01:31 | yselivanov | set | keywords:
+ patch stage: patch review pull_requests: + pull_request7604 |
| 2018-06-28 16:42:41 | gvanrossum | set | messages: + msg320675 |
| 2018-06-28 11:37:33 | bay | set | nosy:
+ bay messages: + msg320660 |
| 2018-05-29 09:28:31 | sebastien.bourdeauducq | set | messages: + msg317997 |
| 2017-02-28 12:35:36 | sebastien.bourdeauducq | set | messages: + msg288712 |
| 2017-01-25 22:24:21 | gregory.p.smith | set | nosy:
+ gregory.p.smith |
| 2016-07-12 18:46:27 | sebastien.bourdeauducq | set | messages: + msg270263 |
| 2016-07-12 17:55:35 | sebastien.bourdeauducq | create | |