Jump to solution
Details

The Fix

pip install redis==7.1.0

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

Production note: This tends to surface only under concurrency. Reproduce with load tests and watch for lock contention/cancellation paths.

Open PR/Commit
@@ -369,6 +369,8 @@ def __init__( raise RedisError("Client caching is only supported with RESP version 3") + # TODO: To avoid breaking changes during the bug fix, we have to keep non-reentrant lock. + # TODO: Remove this before next major version (7.0.0) self.single_connection_lock = threading.Lock()
fix.md
Option A — Upgrade to fixed release\npip install redis==7.1.0\nWhen NOT to use: Do not use this fix if backward compatibility is a concern.\n\n

Why This Fix Works in Production

  • Trigger: Possible deadlock in class `Pipeline`
  • Mechanism: Deadlock occurs when __del__ is called during get_connection while holding a lock
  • Why the fix works: Fixed potential deadlock when GC takes action and __del__ invoked in the middle of get_connection() or release() methods. (first fixed release: 7.1.0).
Production impact:
  • If left unfixed, failures can be intermittent under concurrency (hard to reproduce; shows up as sporadic 5xx/timeouts).

Why This Breaks in Prod

  • Shows up under Python 3.11 in real deployments (not just unit tests).
  • Deadlock occurs when __del__ is called during get_connection while holding a lock
  • Production symptom (often without a traceback): Possible deadlock in class `Pipeline`

Proof / Evidence

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

Discussion

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

“Could you please include a small MRE (minimal reproducible example)?”
@alessio-locatelli · 2024-10-26 · repro detail · source

Failure Signature (Search String)

  • Possible deadlock in class `Pipeline`
Copy-friendly signature
signature.txt
Failure Signature ----------------- Possible deadlock in class `Pipeline`

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Possible deadlock in class `Pipeline`

Environment

  • Python: 3.11

Why It Broke

Deadlock occurs when __del__ is called during get_connection while holding a lock

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 backward compatibility is a concern.

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

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 backward compatibility is a concern.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

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

Related Issues

No related fixes found.

Sources

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