The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #2488 · 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%.
@@ -1,3 +1,4 @@
@@ -1,3 +1,4 @@
+ * Add `timeout=None` in `SentinelConnectionManager.read_response`
* Documentation fix: password protected socket connection (#2374)
* Allow `timeout=None` in `PubSub.get_message()` to wait forever
import asyncio
import os
from redis.asyncio import Sentinel
REDIS_PASSWORD = os.getenv("REDIS_PASSWORD", "")
REDIS_DB = int(os.getenv("REDIS_DB", 0))
SENTINEL_PASSWORD = os.getenv("SENTINEL_PASSWORD", "")
SENTINEL_URLS = [
s.strip() for s in os.getenv("SENTINEL_URLS", "127.0.0.1:26379").split(",") if s.strip()
]
async def foobar() -> None:
stnl = Sentinel(
[s.split(":") for s in SENTINEL_URLS],
sentinel_kwargs={"password": SENTINEL_PASSWORD},
password=REDIS_PASSWORD,
db=REDIS_DB,
)
redis = stnl.master_for("mymaster")
# So far so good:
await redis.set("foo", "bar")
await redis.expire("foo", 10)
print("GET foo:", await redis.get("foo"))
# This is where it fails:
channel = redis.pubsub()
await channel.psubscribe("foo*")
async for msg in channel.listen():
print(msg)
def main() -> None:
asyncio.run(foobar())
if __name__ == "__main__":
main()
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 timeout feature for message handling.\n\n
Why This Fix Works in Production
- Trigger: main()
- Mechanism: The Sentinel connection does not support the timeout argument, causing a TypeError
- Why the fix works: Adds a timeout parameter to the SentinelManagedConnection to resolve the issue with unexpected keyword argument 'timeout'. (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.5.1 in real deployments (not just unit tests).
- The Sentinel connection does not support the timeout argument, causing a TypeError
- Surfaces as: Traceback (most recent call last):
Proof / Evidence
- GitHub issue: #2488
- Fix PR: https://github.com/redis/redis-py/pull/2495
- 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.30
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@dvora-h it looks like the Sentinel connection doesn't support the Timeout, and this is plumbed all the way down. @vivienm Any chance you'd be interested…”
“> @vivienm Any chance you'd be interested in contributing a fix? Sorry, I'm afraid I won't have much time in the coming weeks 😕”
“Just for the record, I made a fix here if needed”
Failure Signature (Search String)
- main()
Error Message
Stack trace
Error Message
-------------
Traceback (most recent call last):
File "fail.py", line 41, in <module>
main()
File "fail.py", line 37, in main
asyncio.run(foobar())
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "fail.py", line 32, in foobar
async for msg in channel.listen():
File "virtualenvs/fail/lib/python3.10/site-packages/redis/asyncio/client.py", line 891, in listen
response = await self.handle_message(await self.parse_response(block=True))
File "virtualenvs/fail/lib/python3.10/site-packages/redis/asyncio/client.py", line 784, in parse_response
response = await self._execute(conn, conn.read_response, timeout=read_timeout)
File "virtualenvs/fail/lib/python3.10/site-packages/redis/asyncio/client.py", line 764, in _execute
return await conn.retry.call_with_retry(
File "virtualenvs/fail/lib/python3.10/site-packages/redis/asyncio/retry.py", line 59, in call_with_retry
return await do()
File "virtualenvs/fail/lib/python3.10/site-packages/redis/asyncio/client.py", line 765, in <lambda>
lambda: command(*args, **kwargs),
TypeError: SentinelManagedConnection.read_response() got an unexpected keyword argument 'timeout'
Minimal Reproduction
import asyncio
import os
from redis.asyncio import Sentinel
REDIS_PASSWORD = os.getenv("REDIS_PASSWORD", "")
REDIS_DB = int(os.getenv("REDIS_DB", 0))
SENTINEL_PASSWORD = os.getenv("SENTINEL_PASSWORD", "")
SENTINEL_URLS = [
s.strip() for s in os.getenv("SENTINEL_URLS", "127.0.0.1:26379").split(",") if s.strip()
]
async def foobar() -> None:
stnl = Sentinel(
[s.split(":") for s in SENTINEL_URLS],
sentinel_kwargs={"password": SENTINEL_PASSWORD},
password=REDIS_PASSWORD,
db=REDIS_DB,
)
redis = stnl.master_for("mymaster")
# So far so good:
await redis.set("foo", "bar")
await redis.expire("foo", 10)
print("GET foo:", await redis.get("foo"))
# This is where it fails:
channel = redis.pubsub()
await channel.psubscribe("foo*")
async for msg in channel.listen():
print(msg)
def main() -> None:
asyncio.run(foobar())
if __name__ == "__main__":
main()
Environment
- Python: 3.5.1
What Broke
The application fails to subscribe to messages, resulting in missed notifications.
Why It Broke
The Sentinel connection does not support the timeout argument, causing a TypeError
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/2495
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 the application relies on the timeout feature for message handling.
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.