The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #2965 · 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%.
@@ -138,12 +138,6 @@ def __init__(self, socket_read_size: int):
self._read_size = socket_read_size
- def __del__(self):
- try:
- self.on_disconnect()
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 private method behavior.\n\n
Why This Fix Works in Production
- Trigger: connection.register_connect_callback(stop_callback)
- Mechanism: The public API of AbstractConnection was changed, making register_connect_callback private
- Why the fix works: The public API of AbstractConnection was changed in version 5.0.1, making register_connect_callback private. (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.9 in real deployments (not just unit tests).
- The public API of AbstractConnection was changed, making register_connect_callback private
- Surfaces as: File "/home/denolf/dev/bliss/blissdata/blissdata/redis/caching.py", line 150, in _create_invalidation_connection
Proof / Evidence
- GitHub issue: #2965
- Fix PR: https://github.com/redis/redis-py/pull/2870
- 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.73
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Just to add here, register_connect_callback is used by the celery redis result backend: https://github.com/celery/celery/blob/0bc89cc594638e1d88655764807fcc59fb32efc6/celery/backends/redis.py#L122 So with redis-py 5.0.1 we see errors with checking celery resul”
“Same goes for clear_connect_callbacks: it was replace by _deregister_connect_callback.”
“Yes, that one was problematic because it clears them all, not just the one you registered. But it is not really needed because the callbacks…”
“Hello @kristjanvalur, We have a use case that is currently achieved by registering our own callbacks using register_connect_callback Are there plans to bring the public…”
Failure Signature (Search String)
- connection.register_connect_callback(stop_callback)
Error Message
Stack trace
Error Message
-------------
File "/home/denolf/dev/bliss/blissdata/blissdata/redis/caching.py", line 150, in _create_invalidation_connection
connection.register_connect_callback(stop_callback)
AttributeError: 'UnixDomainSocketConnection' object has no attribute 'register_connect_callback'
Environment
- Python: 3.9
What Broke
Errors occur when using client-side caching with Celery due to missing callback registration.
Why It Broke
The public API of AbstractConnection was changed, making register_connect_callback private
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/2870
First fixed release: 7.1.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the application relies on the private method behavior.
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
| 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.