The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #1348 · 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%.
@@ -1098,6 +1098,7 @@ def lock(
timeout=None,
sleep=0.1,
+ blocking=True,
blocking_timeout=None,
lock_class=None,
try:
with …
pass # do stuff
except:
pass # handle errors
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 use this fix if you require the original blocking behavior of the lock.\n\n
Why This Fix Works in Production
- Trigger: Question: why is `blocking` missing as a lock() parameter?
- Mechanism: The 'blocking' parameter was missing from the lock() function, causing inconsistency with the Lock class
- Why the fix works: Added the missing 'blocking' parameter to the lock() function to make it consistent with the Lock class. (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
- The 'blocking' parameter was missing from the lock() function, causing inconsistency with the Lock class
- Production symptom (often without a traceback): Question: why is `blocking` missing as a lock() parameter?
Proof / Evidence
- GitHub issue: #1348
- Fix PR: https://github.com/redis/redis-py/pull/2137
- First fixed release: 7.1.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-07
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.76
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Hello @jenstroeger! Maybe @chayim could answer your question. I am also interested and ready to step in if needed.”
“> We could probably add that”
“This issue is marked stale. It will be closed in 30 days if it is not updated.”
“> I assume that it's an oversight that the blocking arg is missing from Redis.lock(). We could probably add that. @andymccurdy, want a PR?”
Failure Signature (Search String)
- Question: why is `blocking` missing as a lock() parameter?
- why is that same parameter missing from the `lock()` function:
Copy-friendly signature
Failure Signature
-----------------
Question: why is `blocking` missing as a lock() parameter?
why is that same parameter missing from the `lock()` function:
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Question: why is `blocking` missing as a lock() parameter?
why is that same parameter missing from the `lock()` function:
Minimal Reproduction
try:
with …
pass # do stuff
except:
pass # handle errors
What Broke
Users were unable to use non-blocking locks, leading to potential deadlocks in their applications.
Why It Broke
The 'blocking' parameter was missing from the lock() function, causing inconsistency with the Lock class
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.
Fix reference: https://github.com/redis/redis-py/pull/2137
First fixed release: 7.1.0
Last verified: 2026-02-07. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if you require the original blocking behavior of the lock.
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
- 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
| Version | Status |
|---|---|
| 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.