The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #3139 · 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%.
@@ -223,19 +223,31 @@ async def execute_command(self, *args, **kwargs):
node at random, rather than across the entire sentinel cluster.
"""
- once = bool(kwargs.get("once", False))
- if "once" in kwargs.keys():
- kwargs.pop("once")
root@ubuntu:~# cat sentinel.go
package main
import (
"github.com/redis/go-redis/v9"
"context"
"fmt"
)
func main() {
sentinel := redis.NewSentinelClient(&redis.Options{
Addr: "redis-sentinel-sentinel-headless.redis.svc.cluster.local:26379",
Username: "default",
Password: "asdf"},
)
ctx := context.TODO()
fmt.Print( sentinel.GetMasterAddrByName(ctx, "myMaster").Result() )
}
root@ubuntu:~# go run sentinel.go
[192.168.94.104 6379]
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 the application relies on the boolean return type for logic.\n\n
Why This Fix Works in Production
- Trigger: This does NOT...
- Mechanism: The sentinel_get_master_addr_by_name() function incorrectly returns a boolean instead of a (host, port) pair
- Why the fix works: Fixes the sentinel_get_master_addr_by_name() function to return a (host, port) pair instead of a boolean value. (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
- Shows up under Python 3.10.12 in real deployments (not just unit tests).
- The sentinel_get_master_addr_by_name() function incorrectly returns a boolean instead of a (host, port) pair
- Production symptom (often without a traceback): This does NOT...
Proof / Evidence
- GitHub issue: #3139
- Fix PR: https://github.com/redis/redis-py/pull/3191
- First fixed release: 7.1.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.57
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.”
Failure Signature (Search String)
- This does NOT...
- >> sentinel = redis.sentinel.Sentinel([('redis-sentinel-sentinel-headless.redis.svc.cluster.local', 26379)], socket_timeout=0.5, password='asdf', sentinel_kwargs={'password':
Copy-friendly signature
Failure Signature
-----------------
This does NOT...
>> sentinel = redis.sentinel.Sentinel([('redis-sentinel-sentinel-headless.redis.svc.cluster.local', 26379)], socket_timeout=0.5, password='asdf', sentinel_kwargs={'password': 'asdf'})
Error Message
Signature-only (no traceback captured)
Error Message
-------------
This does NOT...
>> sentinel = redis.sentinel.Sentinel([('redis-sentinel-sentinel-headless.redis.svc.cluster.local', 26379)], socket_timeout=0.5, password='asdf', sentinel_kwargs={'password': 'asdf'})
Minimal Reproduction
root@ubuntu:~# cat sentinel.go
package main
import (
"github.com/redis/go-redis/v9"
"context"
"fmt"
)
func main() {
sentinel := redis.NewSentinelClient(&redis.Options{
Addr: "redis-sentinel-sentinel-headless.redis.svc.cluster.local:26379",
Username: "default",
Password: "asdf"},
)
ctx := context.TODO()
fmt.Print( sentinel.GetMasterAddrByName(ctx, "myMaster").Result() )
}
root@ubuntu:~# go run sentinel.go
[192.168.94.104 6379]
Environment
- Python: 3.10.12
What Broke
Users receive a boolean response instead of the expected (host, port) pair, causing confusion and errors.
Why It Broke
The sentinel_get_master_addr_by_name() function incorrectly returns a boolean instead of a (host, port) pair
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/3191
First fixed release: 7.1.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if the application relies on the boolean return type for logic.
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
- 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
| 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.