From 0d38ffaf36452cae7ec61d53750cd097d7143e42 Mon Sep 17 00:00:00 2001 From: Bea Steers Date: Sat, 26 Mar 2022 13:35:12 -0400 Subject: [PATCH 1/2] always clear reference to reader/writer --- redis/asyncio/connection.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/redis/asyncio/connection.py b/redis/asyncio/connection.py index 0c5398568e..f0e6d3da4f 100644 --- a/redis/asyncio/connection.py +++ b/redis/asyncio/connection.py @@ -827,8 +827,9 @@ async def disconnect(self): await self._writer.wait_closed() # type: ignore[union-attr] except OSError: pass - self._reader = None - self._writer = None + finally: + self._reader = None + self._writer = None except asyncio.TimeoutError: raise TimeoutError( f"Timed out closing connection after {self.socket_connect_timeout}" From deb281bd4871ca43a3736ebd84639b09f7e2c0f2 Mon Sep 17 00:00:00 2001 From: Bea Steers Date: Thu, 31 Mar 2022 13:11:16 -0400 Subject: [PATCH 2/2] add #2065 to changes --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 95843ec7ff..010612f756 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ * Fix cursor returned by SCAN for RedisCluster & change default target to PRIMARIES * Fix scan_iter for RedisCluster * Remove verbose logging when initializing ClusterPubSub, ClusterPipeline or RedisCluster + * Fix broken connection writer lock-up for asyncio (#2065) * 4.1.3 (Feb 8, 2022) * Fix flushdb and flushall (#1926)