Jump to solution
Verify

The Fix

pip install redis==7.1.1

Based on closed redis/redis-py issue #2592 · 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
@@ -1141,7 +1141,7 @@ def _get_command_keys(self, *args): return self.commands_parser.get_keys(redis_conn, *args) - def determine_slot(self, *args) -> int: + def determine_slot(self, *args) -> Optional[int]: """
repro.py
import time from redis import cluster def handler(msg): print('MSG: {}'.format(msg)) if __name__ == '__main__': # client1 = redis.client.Redis.from_url('redis://localhost:6379/0') # works client1 = cluster.RedisCluster.from_url('redis://localhost:6379/0') id = client1.client_id() pubsub = client1.pubsub() pubsub.subscribe(**{'__redis__:invalidate': handler}) pubsub.run_in_thread(daemon=True, sleep_time=None) client1.client_tracking_on(clientid=id, prefix=['foo'], bcast=True) client1.get('fooASF') for i in range(10): client1.set('fooASF', '23423423ff') time.sleep(100)
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.1\nWhen NOT to use: This fix should not be used if client-side caching is not intended, as it may lead to unexpected behavior.\n\n

Why This Fix Works in Production

  • Trigger: client1.client_tracking_on(clientid=id, prefix=['foo'], bcast=True)
  • Mechanism: The redis parser crashes when using client tracking on clustered Redis due to an unhandled case in the command processing
  • Why the fix works: Adds special handling for the client_tracking_on and client_tracking_off functions for cluster clients, marking them as deprecated in favor of using the embedded client-side caching feature. (first fixed release: 7.1.1).
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

  • Shows up under Python 3.8 in real deployments (not just unit tests).
  • The redis parser crashes when using client tracking on clustered Redis due to an unhandled case in the command processing
  • Surfaces as: File "/Users/myuser/projects/xxx/redis_bug.py", line 20, in <module>

Proof / Evidence

  • GitHub issue: #2592
  • Fix PR: https://github.com/redis/redis-py/pull/3858
  • First fixed release: 7.1.1
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-04
  • Confidence: 0.80
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.38

Discussion

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

“This issue is marked stale. It will be closed in 30 days if it is not updated.”
@github-actions · 2024-03-16 · source
“Yes, I was trying to implement client-side caching using cluster setup”
@matejsp · 2025-11-26 · source
“> o implement client-side caching using cluster setup”
@petyaslavova · 2025-11-27 · source
“Hi @matejsp, Could you please clarify what the end goal was? Were you aiming to implement something similar to client-side caching in a cluster setup,…”
@petyaslavova · 2025-11-26 · source

Failure Signature (Search String)

  • client1.client_tracking_on(clientid=id, prefix=['foo'], bcast=True)

Error Message

Stack trace
error.txt
Error Message ------------- File "/Users/myuser/projects/xxx/redis_bug.py", line 20, in <module> client1.client_tracking_on(clientid=id, prefix=['foo'], bcast=True) File "/Users/myuser/.virtualenvs/bitstamp38/lib/python3.8/site-packages/redis/commands/core.py", line 603, in client_tracking_on return self.client_tracking( File "/Users/myuser/.virtualenvs/bitstamp38/lib/python3.8/site-packages/redis/commands/core.py", line 684, in client_tracking return self.execute_command("CLIENT TRACKING", *pieces) File "/Users/myuser/.virtualenvs/bitstamp38/lib/python3.8/site-packages/redis/cluster.py", line 1074, in execute_command raise e File "/Users/myuser/.virtualenvs/bitstamp38/lib/python3.8/site-packages/redis/cluster.py", line 1047, in execute_command target_nodes = self._determine_nodes( File "/Users/myuser/.virtualenvs/bitstamp38/lib/python3.8/site-packages/redis/cluster.py", line 875, in _determine_nodes slot = self.determine_slot(*args) File "/Users/myuser/.virtualenvs/bitstamp38/lib/python3.8/site-packages/redis/cluster.py", line 945, in determine_slot keys = self._get_command_keys(*args) File "/Users/myuser/.virtualenvs/bitstamp38/lib/python3.8/site-packages/redis/cluster.py", line 912, in _get_command_keys return self.commands_parser.get_keys(redis_conn, *args) File "/Users/myuser/.virtualenvs/bitstamp38/lib/python3.8/site-packages/redis/commands/parser.py", ... (truncated) ...

Minimal Reproduction

repro.py
import time from redis import cluster def handler(msg): print('MSG: {}'.format(msg)) if __name__ == '__main__': # client1 = redis.client.Redis.from_url('redis://localhost:6379/0') # works client1 = cluster.RedisCluster.from_url('redis://localhost:6379/0') id = client1.client_id() pubsub = client1.pubsub() pubsub.subscribe(**{'__redis__:invalidate': handler}) pubsub.run_in_thread(daemon=True, sleep_time=None) client1.client_tracking_on(clientid=id, prefix=['foo'], bcast=True) client1.get('fooASF') for i in range(10): client1.set('fooASF', '23423423ff') time.sleep(100)

Environment

  • Python: 3.8

What Broke

The application experiences crashes when attempting to enable client tracking in a clustered environment.

Why It Broke

The redis parser crashes when using client tracking on clustered Redis due to an unhandled case in the command processing

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install redis==7.1.1

When NOT to use: This fix should not be used if client-side caching is not intended, as it may lead to unexpected behavior.

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

First fixed release: 7.1.1

Last verified: 2026-02-04. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix should not be used if client-side caching is not intended, as it may lead to unexpected behavior.

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

  • Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
  • Pin production dependencies and upgrade only with a reproducible test that hits the failing path.

Version Compatibility Table

VersionStatus
7.1.1 Fixed

Related Issues

No related fixes found.

Sources

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