Jump to solution
Verify

The Fix

pip install redis==7.1.1

Based on closed redis/redis-py issue #3692 · PR/commit linked

Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.

Jump to Verify Open PR/Commit
@@ -1215,16 +1215,17 @@ def can_get_connection(self) -> bool: ) async def get_connection(self, command_name=None, *keys, **options): + """Get a connected connection from the pool""" async with self._lock: - """Get a connected connection from the pool"""
repro.py
self.redis_pool = redis.ConnectionPool.from_url(...) # Create a Redis client using the connection pool self.redis_client = redis.Redis(connection_pool=self.redis_pool) # warm up to create all connections.. conns = [] for _ in range(self.max_connections): conn = await self.redis_pool.get_connection('warmup') await conn.connect() # actually opens the TCP connection conns.append(conn) # Release all connections back to the pool for conn in conns: await self.redis_pool.release(conn)
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.1\nWhen NOT to use: This fix should not be applied if the application relies on the lock for thread safety.\n\n

Why This Fix Works in Production

  • Trigger: This way, the `ensure_connection` call returns immediately and the lock does not cause a lot of queue up.
  • Mechanism: Fixes an async connection pool lock contention issue during connection establishment, which was causing performance degradation since version 5.3.0.
  • Why the fix works: Fixes an async connection pool lock contention issue during connection establishment, which was causing performance degradation since version 5.3.0. (first fixed release: 7.1.1).
Production impact:
  • If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.

Why This Breaks in Prod

  • Production symptom (often without a traceback): This way, the `ensure_connection` call returns immediately and the lock does not cause a lot of queue up.

Proof / Evidence

  • GitHub issue: #3692
  • Fix PR: https://github.com/redis/redis-py/pull/3885
  • First fixed release: 7.1.1
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.70
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.53

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“Hi @d33kayyy, thanks for bringing this to our attention. We will take a look at it soon.”
@petyaslavova · 2025-07-04 · source
“+1 for this issue. In the meantime, we found a solution wherein we warm up the redis pool on service startup: This way, the ensure_connection…”
@rishabhpoddar · 2025-11-11 · source

Failure Signature (Search String)

  • This way, the `ensure_connection` call returns immediately and the lock does not cause a lot of queue up.
Copy-friendly signature
signature.txt
Failure Signature ----------------- This way, the `ensure_connection` call returns immediately and the lock does not cause a lot of queue up.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- This way, the `ensure_connection` call returns immediately and the lock does not cause a lot of queue up.

Minimal Reproduction

repro.py
self.redis_pool = redis.ConnectionPool.from_url(...) # Create a Redis client using the connection pool self.redis_client = redis.Redis(connection_pool=self.redis_pool) # warm up to create all connections.. conns = [] for _ in range(self.max_connections): conn = await self.redis_pool.get_connection('warmup') await conn.connect() # actually opens the TCP connection conns.append(conn) # Release all connections back to the pool for conn in conns: await self.redis_pool.release(conn)

What Broke

Under high load, connection acquisition delays led to noticeable performance degradation.

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install redis==7.1.1

When NOT to use: This fix should not be applied if the application relies on the lock for thread safety.

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/3885

First fixed release: 7.1.1

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix should not be applied if the application relies on the lock for thread safety.

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

  • 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.1 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.