Closed
Description
Version: What redis-py and what redis version is the issue happening on?
redis-py 4.4.2 / redis 6.0.5
Platform: What platform / version? (For example Python 3.5.1 on Windows 7 / Ubuntu 15.10 / Azure)
Python 3.9 on MacOS Ventura 13.4.1
Description: Description of your issue, stack traces from errors and code that reproduces the issue
Recently, I've faced a situation where connections never get returned to a connection pool, when there is a surge of Redis commands. while investigating the incident, i've found out that the below scenario can cause a connection leak
- ClusterPipeline is stacked with commands that needs to be directed to at least two nodes
- let's say node 1 and node 2
- ClusterPipeline obtains a connection to node 1 successfully
- ClusterPipeline fails to obtain a connection to node 2 due to ConnectionError
- ClusterPipeline retries the entire process again, but doesn't release an acquired connection to node 1 before doing that
below code includes a test case to cause a connection leak and a possible solution to the problem
Let me know, if you guys think this is an actual issue :)