Jump to solution
Verify

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.

Jump to Verify Open PR/Commit
@@ -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()
repro.py
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)
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
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).
Production impact:
  • 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 · 2022-05-21 · source
“@donbowman no, this issue (and corresponding PR) is specific to the async API.”
@elemoine · 2022-05-23 · source

Failure Signature (Search String)

  • errors = (ConnectionError, TimeoutError)
Copy-friendly signature
signature.txt
Failure Signature ----------------- from redis.exceptions import ConnectionError, TimeoutError errors = (ConnectionError, TimeoutError)

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- from redis.exceptions import ConnectionError, TimeoutError errors = (ConnectionError, TimeoutError)

Minimal Reproduction

repro.py
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

When NOT to use: Do not use this fix if the application relies on immediate failure for ConnectionError.

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.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not use this fix if the application relies on immediate failure for ConnectionError.

Verify Fix

verify
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

VersionStatus
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.