Jump to solution
Verify

The Fix

pip install redis==7.1.0

Based on closed redis/redis-py issue #2901 · 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
@@ -44,6 +44,26 @@ ] }, + { + "cell_type": "markdown", + "metadata": {},
repro.py
when this client is closed, the internal connection pool remains open, i.e. its connections are not shut down. The `Redis` class includes a `auto_close_connection_pool` argument. However, this is _ignored_ when a connection pool is provided to the constructor. Presumably the thinking is that the caller will manage that pool himself. But that makes the above kind of pattern, also used within the code, unusable.
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 you require manual management of connection pools.\n\n

Why This Fix Works in Production

  • Trigger: is closed, to free the user from such hassles. Examples in the code include
  • Mechanism: The `auto_close_connection_pool` argument is ignored when a connection pool is provided to the Redis constructor
  • Why the fix works: Adds a new `from_pool()` class method to the Redis client, allowing it to take ownership of a ConnectionPool and close it automatically, addressing issue #2901. (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

  • The `auto_close_connection_pool` argument is ignored when a connection pool is provided to the Redis constructor
  • Production symptom (often without a traceback): is closed, to free the user from such hassles. Examples in the code include

Proof / Evidence

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

Discussion

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

“This defect pertains to issues discovered with #2831 In async mode, it is important that a Redis object which holds its own pool, can be told to close it when the Redis object is closed, to free the user from such hassles. Examples in the c”
Issue thread · issue description · source

Failure Signature (Search String)

  • is closed, to free the user from such hassles. Examples in the code include
  • assert client.auto_close_connection_pool=False
Copy-friendly signature
signature.txt
Failure Signature ----------------- is closed, to free the user from such hassles. Examples in the code include assert client.auto_close_connection_pool=False

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- is closed, to free the user from such hassles. Examples in the code include assert client.auto_close_connection_pool=False

Minimal Reproduction

repro.py
when this client is closed, the internal connection pool remains open, i.e. its connections are not shut down. The `Redis` class includes a `auto_close_connection_pool` argument. However, this is _ignored_ when a connection pool is provided to the constructor. Presumably the thinking is that the caller will manage that pool himself. But that makes the above kind of pattern, also used within the code, unusable.

What Broke

Redis clients do not automatically close their connection pools, leading to resource leaks.

Why It Broke

The `auto_close_connection_pool` argument is ignored when a connection pool is provided to the Redis constructor

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 you require manual management of connection pools.

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

First fixed release: 7.1.0

Last verified: 2026-02-08. 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 you require manual management of connection pools.

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 TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
  • Alert on handshake failures by error string and endpoint to catch cert/CA changes quickly.
  • 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.

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.