## TL;DR

[kristjanvalur (contributor)]: Redis Sentinel's master_for/slave_for did not set up the client correctly, leaking connections. Fixed by PR #2900 (merged).

## Steps

1. [kristjanvalur (contributor)]: Redis Sentinel's master_for/slave_for did not set up the client correctly, leaking connections. Fixed by PR #2900 (merged). Workaround on older versions: set client.auto_close_connection_pool = True after master_for. Reporters confirmed stable client counts on 5.0 with connections closed via context managers.

## When to use

You are seeing this: Redis Vector Search - Version: 4.6.0 Platform: Python 3.10 / Docker or Linux Server : Redis 7.0.11 Description: We have an application using redis in an async context for months now. Use this skill when you run into "4.6.0 - ConnectionError max number of clients reached".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

Versions mentioned in the source: 4.6.0, Redis 7.0.11. If you are on something much newer or older, the details may have shifted.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

## Sources

- https://github.com/redis/redis-py/issues/2831
