The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #2831 · 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%.
@@ -1,3 +1,4 @@
@@ -1,3 +1,4 @@
+ * Fix #2749, remove unnecessary __del__ logic to close connections.
* Fix #2754, adding a missing argument to SentinelManagedConnection
* Fix `xadd` command to accept non-negative `maxlen` including 0
from redis.asyncio import Redis
from app import settings
async def get_redis_connection():
redis = Redis.from_url(settings.REDIS_URL)
return redis
async def list_queued_job_ids():
redis_conn = await get_redis_connection()
... do something with redis data and related code ...
await redis_conn.close()
return something
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 apply this fix if your application relies on custom connection handling.\n\nOption C — Workaround\nto set a client timeout to pass the one hour issue (`config set timeout 60`)\nWhen NOT to use: Do not apply this fix if your application relies on custom connection handling.\n\n
Why This Fix Works in Production
- Trigger: TypeError: AbstractConnection.__init__() got an unexpected keyword argument 'auto_close_connection_pool'
- Mechanism: Unnecessary __del__ handlers were causing connection issues in the async context
- Why the fix works: Removed unnecessary __del__ handlers to prevent connection issues. (first fixed release: 7.1.0).
- 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
- Triggered by an upgrade/regression window: 5.0.0 breaks; 7.1.0 is the first fixed release.
- Shows up under Python 3.10 in real deployments (not just unit tests).
- Unnecessary __del__ handlers were causing connection issues in the async context
- Surfaces as: TypeError: AbstractConnection.__init__() got an unexpected keyword argument 'auto_close_connection_pool'
Proof / Evidence
- GitHub issue: #2831
- Fix PR: https://github.com/redis/redis-py/pull/2755
- First fixed release: 7.1.0
- Affected versions: 5.0.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.66
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Issue https://github.com/redis/redis-py/issues/2814 reports connections not being released to their pool. Maybe related?”
“> Issue #2814 reports connections not being released to their pool. Maybe related? I'm not in a cluster context (single redis instance) but who knows...…”
“For the record, I could deploy fix on staging and production environments with 5.0 and number of connected clients is stable over time as for…”
“> It's a FastAPI app with arq workers also - so extracting the code for easy reproduction is not that easy 😢 I haven't tried…”
Failure Signature (Search String)
- TypeError: AbstractConnection.__init__() got an unexpected keyword argument 'auto_close_connection_pool'
Error Message
Stack trace
Error Message
-------------
TypeError: AbstractConnection.__init__() got an unexpected keyword argument 'auto_close_connection_pool'
Minimal Reproduction
from redis.asyncio import Redis
from app import settings
async def get_redis_connection():
redis = Redis.from_url(settings.REDIS_URL)
return redis
async def list_queued_job_ids():
redis_conn = await get_redis_connection()
... do something with redis data and related code ...
await redis_conn.close()
return something
Environment
- Python: 3.10
What Broke
Application fails with ConnectionError due to exceeding max number of clients.
Why It Broke
Unnecessary __del__ handlers were causing connection issues in the async context
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.
Option C — Workaround Temporary workaround
to set a client timeout to pass the one hour issue (`config set timeout 60`)
Use only if you cannot change versions today. Treat this as a stopgap and remove once upgraded.
Fix reference: https://github.com/redis/redis-py/pull/2755
First fixed release: 7.1.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not apply this fix if your application relies on custom connection handling.
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.
- 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 |
|---|---|
| 5.0.0 | Broken |
| 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.