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%.
@@ -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"""
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)
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.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).
- 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.”
“+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…”
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
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 Message
-------------
This way, the `ensure_connection` call returns immediately and the lock does not cause a lot of queue up.
Minimal Reproduction
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
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.
When NOT to Use This Fix
- This fix should not be applied if the application relies on the lock for thread safety.
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
- 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.1 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.