Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

fix: possible connection leak in pipeline when max_connections is reached #420

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion rediscluster/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,13 @@ def _send_cluster_commands(self, stack, raise_on_error=True, allow_redirections=
# we can build a list of commands for each node.
node_name = node['name']
if node_name not in nodes:
nodes[node_name] = NodeCommands(self.parse_response, self.connection_pool.get_connection_by_node(node))
try:
nodes[node_name] = NodeCommands(self.parse_response, self.connection_pool.get_connection_by_node(node))
except RedisClusterException:
# we may run into "Too many connections" error. all unused connections should be released
for n in nodes.values():
self.connection_pool.release(n.connection)
raise

nodes[node_name].append(c)

Expand Down