The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #2179 · 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.
@@ -1157,7 +1157,7 @@ async def ensure_connection(self, connection: AbstractConnection):
if await connection.can_read_destructive():
raise ConnectionError("Connection has data") from None
- except (ConnectionError, OSError):
+ except (ConnectionError, TimeoutError, OSError):
await connection.disconnect()
from redis.asyncio import BlockingConnectionPool, StrictClient
from redis.exceptions import ConnectionError, TimeoutError
from redis.asyncio.retry import Retry
errors = (ConnectionError, TimeoutError)
retry = Retry(backoff=backoff, retries=retries, supported_errors=errors)
pool = BlockingConnectionPool(retry=retry, retry_on_timeout=True)
client = StrictClient(connection_pool=pool)
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: Do not use this fix if the application relies on immediate failure for ConnectionError.\n\n
Why This Fix Works in Production
- Trigger: errors = (ConnectionError, TimeoutError)
- Mechanism: The error handler in call_with_retry re-raises ConnectionError before retrying
- Why the fix works: Fixes the retry mechanism in the asyncio mode of the Redis client, ensuring that retries occur for ConnectionError exceptions as well. (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 error handler in call_with_retry re-raises ConnectionError before retrying
- Production symptom (often without a traceback): from redis.exceptions import ConnectionError, TimeoutError
Proof / Evidence
- GitHub issue: #2179
- Fix PR: https://github.com/redis/redis-py/pull/1485
- First fixed release: 7.1.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-07
- Confidence: 0.75
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.60
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“does this relate to https://github.com/redis/redis-py/pull/1485 ?”
“@donbowman no, this issue (and corresponding PR) is specific to the async API.”
Failure Signature (Search String)
- errors = (ConnectionError, TimeoutError)
Copy-friendly signature
Failure Signature
-----------------
from redis.exceptions import ConnectionError, TimeoutError
errors = (ConnectionError, TimeoutError)
Error Message
Signature-only (no traceback captured)
Error Message
-------------
from redis.exceptions import ConnectionError, TimeoutError
errors = (ConnectionError, TimeoutError)
Minimal Reproduction
from redis.asyncio import BlockingConnectionPool, StrictClient
from redis.exceptions import ConnectionError, TimeoutError
from redis.asyncio.retry import Retry
errors = (ConnectionError, TimeoutError)
retry = Retry(backoff=backoff, retries=retries, supported_errors=errors)
pool = BlockingConnectionPool(retry=retry, retry_on_timeout=True)
client = StrictClient(connection_pool=pool)
What Broke
Retries do not occur for ConnectionError exceptions, leading to failed commands.
Why It Broke
The error handler in call_with_retry re-raises ConnectionError before retrying
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/1485
First fixed release: 7.1.0
Last verified: 2026-02-07. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if the application relies on immediate failure for 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
- Add a stress test that runs high-concurrency workloads and fails on thread dumps / blocked locks.
- Enable watchdog dumps in prod (faulthandler, thread dump endpoint) to capture deadlocks quickly.
- Track RSS + object counts after deployments; alert on monotonic growth and GC pressure.
- Add a long-running test that repeats the failing call path and asserts stable memory.
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.