Jump to solution
Verify

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

Jump to Verify Open PR/Commit
@@ -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
repro.py
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
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 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).
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

  • 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?”
@woutdenolf · 2023-07-19 · confirmation · source
“> 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...…”
@nsteinmetz · 2023-07-19 · confirmation · source
“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…”
@nsteinmetz · 2023-08-18 · confirmation · source
“> It's a FastAPI app with arq workers also - so extracting the code for easy reproduction is not that easy 😢 I haven't tried…”
@Harry-Lees · 2023-08-17 · repro detail · source

Failure Signature (Search String)

  • TypeError: AbstractConnection.__init__() got an unexpected keyword argument 'auto_close_connection_pool'

Error Message

Stack trace
error.txt
Error Message ------------- TypeError: AbstractConnection.__init__() got an unexpected keyword argument 'auto_close_connection_pool'

Minimal Reproduction

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

When NOT to use: Do not apply this fix if your application relies on custom connection handling.

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`)

When NOT to use: Do not apply this fix if your application relies on custom connection handling.

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.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not apply this fix if your application relies on custom connection handling.

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

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