Issue36069
Created on 2019-02-21 19:13 by Leonardo Mörlein, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg336253 - (view) | Author: Leonardo Mörlein (Leonardo Mörlein) | Date: 2019-02-21 19:13 | |
The tuple (host, port) is ("fe80::5054:01ff:fe04:3402%node4_client", 22) in https://github.com/python/cpython/blob/master/Lib/asyncio/base_events.py#L918. The substring "node4_client" identifies the interface, which is needed for link local connections.
The function self._ensure_resolved() is called and resolves to
infos[0][4] = ("fe80::5054:01ff:fe04:3402", 22, something, 93), where 93 is the resolved scope id (see sin6_scope_id from struct sockaddr_in6 from man ipv6).
Afterwards the self.sock_connect() is called with address = infos[0][4]. In self.sock_connect() the function self._ensure_resolved() is called again. In https://github.com/python/cpython/blob/master/Lib/asyncio/base_events.py#L1282 the scope id is stripped from the tuple. The tuple (host, port) is now only ("fe80::5054:01ff:fe04:3402", 22) and therefore the scope id is lost.
I wrote this quick fix, which is not really suitable as a real solution for the problem:
lemoer@orange ~> diff /usr/lib/python3.7/asyncio/base_events.py{.bak,}
--- /usr/lib/python3.7/asyncio/base_events.py.bak 2019-02-21 18:42:17.060122277 +0100
+++ /usr/lib/python3.7/asyncio/base_events.py 2019-02-21 18:49:36.886866750 +0100
@@ -942,8 +942,8 @@
sock = None
continue
if self._debug:
- logger.debug("connect %r to %r", sock, address)
- await self.sock_connect(sock, address)
+ logger.debug("connect %r to %r", sock, (host, port))
+ await self.sock_connect(sock, (host, port))
except OSError as exc:
if sock is not None:
sock.close()
|
|||
| msg336254 - (view) | Author: Leonardo Mörlein (Leonardo Mörlein) | Date: 2019-02-21 19:16 | |
The generated error is: OSError: [Errno 22] Invalid argument |
|||
| msg336255 - (view) | Author: Leonardo Mörlein (Leonardo Mörlein) | Date: 2019-02-21 19:28 | |
It seems to be a regression, as my python 3.6 version is not affected: lemoer@orange ~> python3.6 --version Python 3.6.8 My python 3.7 version is affected: lemoer@orange ~> python3.7 --version Python 3.7.2 |
|||
| msg336281 - (view) | Author: twisteroid ambassador (twisteroid ambassador) * | Date: 2019-02-22 06:26 | |
Duplicate of issue35545, I believe. |
|||
| msg336284 - (view) | Author: Leonardo Mörlein (Leonardo Mörlein) | Date: 2019-02-22 08:05 | |
Oh, you are correct. So this can be closed. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:11 | admin | set | github: 80250 |
| 2019-02-22 08:05:56 | Leonardo Mörlein | set | status: open -> closed stage: resolved |
| 2019-02-22 08:05:17 | Leonardo Mörlein | set | messages: + msg336284 |
| 2019-02-22 06:26:04 | twisteroid ambassador | set | nosy:
+ twisteroid ambassador messages: + msg336281 |
| 2019-02-21 19:28:28 | Leonardo Mörlein | set | messages: + msg336255 |
| 2019-02-21 19:16:05 | Leonardo Mörlein | set | messages: + msg336254 |
| 2019-02-21 19:13:47 | Leonardo Mörlein | create | |