The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #2983 · 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%.
@@ -861,6 +861,7 @@ def to_bool(value) -> Optional[bool]:
"health_check_interval": int,
"ssl_check_hostname": to_bool,
+ "timeout": float,
}
)
>> from redis.connection import BlockingConnectionPool
>> pool = BlockingConnectionPool.from_url("redis://127.0.0.1:6379/1?timeout=42")
>> pool.timeout
'42'
>> pool.get_connection("PING")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/r0ro/.virtualenvs/backoffice/lib/python3.10/site-packages/redis/connection.py", line 1262, in get_connection
connection = self.pool.get(block=True, timeout=self.timeout)
File "/usr/lib/python3.10/queue.py", line 172, in get
elif timeout < 0:
TypeError: '<' not supported between instances of 'str' and 'int'
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 timeout parameter is expected to remain a string.\n\n
Why This Fix Works in Production
- Trigger: >> from redis.connection import BlockingConnectionPool
- Mechanism: Missing cast in URL_QUERY_ARGUMENT_PARSERS for 'timeout' parameter causes a runtime TypeError
- Why the fix works: Fixes the issue where the 'timeout' parameter in the URL query was not being cast to float, leading to a TypeError when used in comparisons. (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 in real deployments (not just unit tests).
- Missing cast in URL_QUERY_ARGUMENT_PARSERS for 'timeout' parameter causes a runtime TypeError
- Surfaces as: >> from redis.connection import BlockingConnectionPool
Proof / Evidence
- GitHub issue: #2983
- Fix PR: https://github.com/redis/redis-py/pull/2984
- First fixed release: 7.1.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-08
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.50
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“**Version**: 5.0.1 **Platform**: All **Description**: Missing cast in URL_QUERY_ARGUMENT_PARSERS for "timeout" parameter causes a runtime TypeError When instantiating a BlockingConnectionPool from url with timeout query parameter, timeout i”
Failure Signature (Search String)
- >> from redis.connection import BlockingConnectionPool
Error Message
Stack trace
Error Message
-------------
>> from redis.connection import BlockingConnectionPool
>> pool = BlockingConnectionPool.from_url("redis://127.0.0.1:6379/1?timeout=42")
>> pool.timeout
'42'
>> pool.get_connection("PING")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/r0ro/.virtualenvs/backoffice/lib/python3.10/site-packages/redis/connection.py", line 1262, in get_connection
connection = self.pool.get(block=True, timeout=self.timeout)
File "/usr/lib/python3.10/queue.py", line 172, in get
elif timeout < 0:
TypeError: '<' not supported between instances of 'str' and 'int'
Minimal Reproduction
>> from redis.connection import BlockingConnectionPool
>> pool = BlockingConnectionPool.from_url("redis://127.0.0.1:6379/1?timeout=42")
>> pool.timeout
'42'
>> pool.get_connection("PING")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/r0ro/.virtualenvs/backoffice/lib/python3.10/site-packages/redis/connection.py", line 1262, in get_connection
connection = self.pool.get(block=True, timeout=self.timeout)
File "/usr/lib/python3.10/queue.py", line 172, in get
elif timeout < 0:
TypeError: '<' not supported between instances of 'str' and 'int'
Environment
- Python: 3.10
What Broke
Instantiating BlockingConnectionPool with timeout leads to TypeError during connection retrieval.
Why It Broke
Missing cast in URL_QUERY_ARGUMENT_PARSERS for 'timeout' parameter causes a runtime 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/2984
First fixed release: 7.1.0
Last verified: 2026-02-08. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if the timeout parameter is expected to remain a string.
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.
- 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
| 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.