The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #3684 · PR/commit linked
Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.
@@ -20,6 +20,7 @@
InvalidPipelineStack,
InvalidResponse,
+ MaxConnectionsError,
OutOfMemoryError,
PubSubError,
def make_connection(self) -> "ConnectionInterface":
if self._created_connections >= self.max_connections:
raise ConnectionError("Too many connections")
self._created_connections += 1
And in the reconnection logic:
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install redis==7.1.0\nWhen NOT to use: This fix is not suitable if existing error handling relies on the generic ConnectionError.\n\n
Why This Fix Works in Production
- Trigger: Error handling of execute_command
- Mechanism: The ConnectionError raised when exceeding max_connections leads to unnecessary cluster reinitialization
- Why the fix works: Addresses issue #3684 by introducing a more specific MaxConnectionsError exception that is raised when a connection pool reaches its maximum connections limit. (first fixed release: 7.1.0).
- If left unfixed, retry loops can amplify load and turn a small outage into a cascade (thundering herd).
Why This Breaks in Prod
- The ConnectionError raised when exceeding max_connections leads to unnecessary cluster reinitialization
- Surfaces as: Error handling of execute_command
Proof / Evidence
- GitHub issue: #3684
- Fix PR: https://github.com/redis/redis-py/pull/3698
- First fixed release: 7.1.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-08
- Confidence: 0.75
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.75
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Hi @Sakin-Subbaiah, Thanks for reporting this! It looks like an interesting issue to tackle — I’m looking forward to working on a fix. 🙂”
“Hi @petyaslavova, thanks for looking into this. Do you have any ETA for this?”
“Thanks @petyaslavova for the review, we have raised a PR https://github.com/redis/redis-py/pull/3698 using MaxConnectionError https://github.com/redis/redis-py/blob/a757bad78bf18869cdceb370ca8d05d3a7c96942/redis/exceptions.py#L223 as we observed it was present”
“> ch as MaxConnectionLimitError(subclass of Exception) instead of ConnectionError help in this scenario? Hi @ns-ssubbaiah, I think that the approach with an error that is…”
Failure Signature (Search String)
- Error handling of execute_command
Error Message
Stack trace
Error Message
-------------
Error handling of execute_command
Minimal Reproduction
def make_connection(self) -> "ConnectionInterface":
if self._created_connections >= self.max_connections:
raise ConnectionError("Too many connections")
self._created_connections += 1
And in the reconnection logic:
What Broke
Exceeding max_connections causes connection pool exhaustion and repeated connection attempts.
Why It Broke
The ConnectionError raised when exceeding max_connections leads to unnecessary cluster reinitialization
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install redis==7.1.0
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/redis/redis-py/pull/3698
First fixed release: 7.1.0
Last verified: 2026-02-08. Validate in your environment.
When NOT to Use This Fix
- This fix is not suitable if existing error handling relies on the generic ConnectionError.
Verify Fix
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Make timeouts explicit and test them (unit + integration) to avoid silent behavior changes.
- Instrument retries (attempt count + reason) and alert on spikes to catch dependency slowdowns.
Version Compatibility Table
| Version | Status |
|---|---|
| 7.1.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.