From 6b364a143c5cc0e21cbb894c3be7646381f2c799 Mon Sep 17 00:00:00 2001 From: Alexander Mohr Date: Tue, 3 Apr 2018 18:38:41 -0700 Subject: [PATCH 1/5] fix resolve cancellation --- aiohttp/connector.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aiohttp/connector.py b/aiohttp/connector.py index f506230ad42..6d06b1976d8 100644 --- a/aiohttp/connector.py +++ b/aiohttp/connector.py @@ -813,10 +813,13 @@ async def _create_direct_connection(self, req, fingerprint = self._get_fingerprint(req) try: - hosts = await self._resolve_host( + # Cancelling this lookup should not cancel the underlying lookup + # or else the cancel event will get broadcast to all the waiters + # across all connections. + hosts = await asyncio.shield(self._resolve_host( req.url.raw_host, req.port, - traces=traces) + traces=traces)) except OSError as exc: # in case of proxy it is not ClientProxyConnectionError # it is problem of resolving proxy ip itself From 78bbb3b0f196590f5d25b824ccf2a9b24ffb3dbd Mon Sep 17 00:00:00 2001 From: Alexander Mohr Date: Thu, 5 Apr 2018 12:28:10 -0700 Subject: [PATCH 2/5] fixes based on review --- aiohttp/connector.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aiohttp/connector.py b/aiohttp/connector.py index 6d06b1976d8..2475085e7bc 100644 --- a/aiohttp/connector.py +++ b/aiohttp/connector.py @@ -816,10 +816,10 @@ async def _create_direct_connection(self, req, # Cancelling this lookup should not cancel the underlying lookup # or else the cancel event will get broadcast to all the waiters # across all connections. - hosts = await asyncio.shield(self._resolve_host( + hosts = await asyncio.shield(self._resolve_host( req.url.raw_host, req.port, - traces=traces)) + traces=traces), loop=self._loop) except OSError as exc: # in case of proxy it is not ClientProxyConnectionError # it is problem of resolving proxy ip itself From ff63d7692a8270969634bf922ad519db19f91aa4 Mon Sep 17 00:00:00 2001 From: Alexander Mohr Date: Fri, 6 Apr 2018 09:10:11 -0700 Subject: [PATCH 3/5] changes based on review --- aiohttp/connector.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/aiohttp/connector.py b/aiohttp/connector.py index 2475085e7bc..556d91fdce0 100644 --- a/aiohttp/connector.py +++ b/aiohttp/connector.py @@ -700,10 +700,7 @@ async def _resolve_host(self, host, port, traces=None): await trace.send_dns_resolvehost_start(host) addrs = await \ - asyncio.shield(self._resolver.resolve(host, - port, - family=self._family), - loop=self._loop) + self._resolver.resolve(host, port, family=self._family) if traces: for trace in traces: await trace.send_dns_resolvehost_end(host) From 7c70a0fafcc090cbca996eb477be9aa9aac055b9 Mon Sep 17 00:00:00 2001 From: Alexander Mohr Date: Mon, 9 Apr 2018 09:34:49 -0700 Subject: [PATCH 4/5] add changes file --- changes/2910.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/2910.bugfix diff --git a/changes/2910.bugfix b/changes/2910.bugfix new file mode 100644 index 00000000000..e10a8534d06 --- /dev/null +++ b/changes/2910.bugfix @@ -0,0 +1 @@ +fix cancellation broadcast during DNS resolve From 1284612d1822f10509b3692f28834e2c644bf09f Mon Sep 17 00:00:00 2001 From: Alexander Mohr Date: Wed, 11 Apr 2018 01:51:25 -0700 Subject: [PATCH 5/5] rename --- {changes => CHANGES}/2910.bugfix | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {changes => CHANGES}/2910.bugfix (100%) diff --git a/changes/2910.bugfix b/CHANGES/2910.bugfix similarity index 100% rename from changes/2910.bugfix rename to CHANGES/2910.bugfix