The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #1739 · 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%.
@@ -1084,6 +1084,10 @@ class initializer. In the case of conflicting arguments, querystring
"""
url_options = parse_url(url)
+
+ if "connection_class" in kwargs:
+ url_options["connection_class"] = kwargs["connection_class"]
import pytest
from redis import connection, from_url
@pytest.mark.parametrize("proto,ConnBase", [
("rediss", connection.SSLConnection),
("unix", connection.UnixDomainSocketConnection),
])
def test_custom_connection_class_connection_pool(proto, ConnBase):
class MyConn(ConnBase):
pass
pool = connection.ConnectionPool.from_url(
url=f"{proto}:///tmp/redis.sock", connection_class=MyConn,
)
conn = pool.make_connection()
assert isinstance(conn, MyConn)
@pytest.mark.parametrize("proto,ConnBase", [
("rediss", connection.SSLConnection),
("unix", connection.UnixDomainSocketConnection),
])
def test_from_url_custom_connection_class(proto, ConnBase):
class MyConn(ConnBase):
pass
redis = from_url(
url=f"{proto}://127.0.0.1", connection_class=MyConn,
)
conn = redis.connection_pool.make_connection()
assert isinstance(conn, MyConn)
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: This fix should not be used if the application relies on the default connection behavior for these URI schemes.\n\n
Why This Fix Works in Production
- Trigger: ("rediss", connection.SSLConnection),
- Mechanism: The connection class cannot be overridden when using certain URI schemes like 'rediss://' or 'unix://'
- Why the fix works: Allows overriding the connection class which is implicitly guessed by the schema provided in the URI, addressing the issue where users could not override the class for `rediss://` and `unix://` URIs. (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 connection class cannot be overridden when using certain URI schemes like 'rediss://' or 'unix://'
- Production symptom (often without a traceback): ("rediss", connection.SSLConnection),
Proof / Evidence
- GitHub issue: #1739
- Fix PR: https://github.com/redis/redis-py/pull/1752
- 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.55
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Second this”
“Given what we currently have for connections - I think this makes sense”
Failure Signature (Search String)
- ("rediss", connection.SSLConnection),
- assert isinstance(conn, MyConn)
Copy-friendly signature
Failure Signature
-----------------
("rediss", connection.SSLConnection),
assert isinstance(conn, MyConn)
Error Message
Signature-only (no traceback captured)
Error Message
-------------
("rediss", connection.SSLConnection),
assert isinstance(conn, MyConn)
Minimal Reproduction
import pytest
from redis import connection, from_url
@pytest.mark.parametrize("proto,ConnBase", [
("rediss", connection.SSLConnection),
("unix", connection.UnixDomainSocketConnection),
])
def test_custom_connection_class_connection_pool(proto, ConnBase):
class MyConn(ConnBase):
pass
pool = connection.ConnectionPool.from_url(
url=f"{proto}:///tmp/redis.sock", connection_class=MyConn,
)
conn = pool.make_connection()
assert isinstance(conn, MyConn)
@pytest.mark.parametrize("proto,ConnBase", [
("rediss", connection.SSLConnection),
("unix", connection.UnixDomainSocketConnection),
])
def test_from_url_custom_connection_class(proto, ConnBase):
class MyConn(ConnBase):
pass
redis = from_url(
url=f"{proto}://127.0.0.1", connection_class=MyConn,
)
conn = redis.connection_pool.make_connection()
assert isinstance(conn, MyConn)
What Broke
Users cannot use custom connection classes for secure or Unix socket connections, leading to limited functionality.
Why It Broke
The connection class cannot be overridden when using certain URI schemes like 'rediss://' or 'unix://'
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/1752
First fixed release: 7.1.0
Last verified: 2026-02-07. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the application relies on the default connection behavior for these URI schemes.
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 TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
- Alert on handshake failures by error string and endpoint to catch cert/CA changes 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.