Skip to content

Commit bd92758

Browse files
Fix ConnectionPool deadlock triggered by gc
Garbage collector sometimes are invoked in block of code which acquired ConnectionPool._lock. This cause deadlock blocking indefinitely whole thread.
1 parent 054caf3 commit bd92758

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
* Fix for Unhandled exception related to self.host with unix socket (#2496)
5656
* Improve error output for master discovery
5757
* Make `ClusterCommandsProtocol` an actual Protocol
58+
* Fix ConnectionPool deadlock triggered by gc
5859

5960
* 4.1.3 (Feb 8, 2022)
6061
* Fix flushdb and flushall (#1926)

redis/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ def __repr__(self) -> (str, str):
10081008
)
10091009

10101010
def reset(self) -> None:
1011-
self._lock = threading.Lock()
1011+
self._lock = threading.RLock()
10121012
self._created_connections = 0
10131013
self._available_connections = []
10141014
self._in_use_connections = set()

0 commit comments

Comments
 (0)