The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #2636 · PR/commit linked
Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.
@@ -1,3 +1,4 @@
@@ -1,3 +1,4 @@
+ * Revert #2104, #2673, add `disconnect_on_error` option to `read_response()` (issues #2506, #2624)
* Add `address_remap` parameter to `RedisCluster`
* Fix incorrect usage of once flag in async Sentinel
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/celery/worker/consumer/consumer.py", line 326, in start
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR blueprint.start(self)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/celery/bootsteps.py", line 116, in start
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR step.start(parent)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/celery/worker/consumer/consumer.py", line 618, in start
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR c.loop(*c.loop_args())
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/celery/worker/loops.py", line 81, in asynloop
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR next(loop)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/kombu/asynchronous/hub.py", line 361, in create_loop
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR cb(*cbargs)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/kombu/transport/redis.py", line 1128, in on_readable
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR self.cycle.on_readable(fileno)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/kombu/transport/redis.py", line 398, in on_readable
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR chan.handlers[type]()
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/kombu/transport/redis.py", line 733, in _receive
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR ret.append(self._receive_one(c))
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR ^^^^^^^^^^^^^^^^^^^^
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/kombu/transport/redis.py", line 743, in _receive_one
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR response = c.parse_response()
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR ^^^^^^^^^^^^^^^^^^
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/client.py", line 1531, in parse_response
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR response = self._execute(conn, try_read)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/client.py", line 1507, in _execute
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR return conn.retry.call_with_retry(
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR ^^^^^^^^^^^^^^^^^^^^^^^^^^^
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/retry.py", line 49, in call_with_retry
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR fail(error)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/client.py", line 1509, in <lambda>
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR lambda error: self._disconnect_raise_connect(conn, error),
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/client.py", line 1496, in _disconnect_raise_connect
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR raise error
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/retry.py", line 46, in call_with_retry
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR return do()
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR ^^^^
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/client.py"
... (truncated) ...
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 applied if the application relies on immediate disconnection behavior.\n\n
Why This Fix Works in Production
- Trigger: redis.exceptions.ConnectionError with 4.5.2
- Mechanism: Adds an option to disable disconnects in the read_response method, addressing issues related to connection errors.
- Why the fix works: Adds an option to disable disconnects in the read_response method, addressing issues related to connection errors. (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.11 in real deployments (not just unit tests).
- Surfaces as: redis.exceptions.ConnectionError with 4.5.2
Proof / Evidence
- GitHub issue: #2636
- Fix PR: https://github.com/redis/redis-py/pull/2695
- 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.36
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Closing as there is no response. If this is still relevant, please reopen.”
“Duplicate of https://github.com/redis/redis-py/issues/2629 Edit: or maybe not because from the trace it seems the socket connection was made.”
“Hi @woutdenolf I did an upgrade to redis-py 4.5.4 today, but sadly the issue above is still there and connection will be closed by server.”
“Nothing obvious comes to mind. I'm using celery with redis just fine (celery 5.3, py-redis 4.5.4, redis-server 6.0). Could you provide a way to reproduce…”
Failure Signature (Search String)
- redis.exceptions.ConnectionError with 4.5.2
Error Message
Stack trace
Error Message
-------------
redis.exceptions.ConnectionError with 4.5.2
Minimal Reproduction
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/celery/worker/consumer/consumer.py", line 326, in start
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR blueprint.start(self)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/celery/bootsteps.py", line 116, in start
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR step.start(parent)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/celery/worker/consumer/consumer.py", line 618, in start
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR c.loop(*c.loop_args())
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/celery/worker/loops.py", line 81, in asynloop
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR next(loop)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/kombu/asynchronous/hub.py", line 361, in create_loop
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR cb(*cbargs)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/kombu/transport/redis.py", line 1128, in on_readable
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR self.cycle.on_readable(fileno)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/kombu/transport/redis.py", line 398, in on_readable
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR chan.handlers[type]()
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/kombu/transport/redis.py", line 733, in _receive
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR ret.append(self._receive_one(c))
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR ^^^^^^^^^^^^^^^^^^^^
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/kombu/transport/redis.py", line 743, in _receive_one
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR response = c.parse_response()
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR ^^^^^^^^^^^^^^^^^^
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/client.py", line 1531, in parse_response
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR response = self._execute(conn, try_read)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/client.py", line 1507, in _execute
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR return conn.retry.call_with_retry(
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR ^^^^^^^^^^^^^^^^^^^^^^^^^^^
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/retry.py", line 49, in call_with_retry
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR fail(error)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/client.py", line 1509, in <lambda>
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR lambda error: self._disconnect_raise_connect(conn, error),
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/client.py", line 1496, in _disconnect_raise_connect
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR raise error
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/retry.py", line 46, in call_with_retry
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR return do()
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR ^^^^
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/client.py"
... (truncated) ...
Environment
- Python: 3.11
What Broke
Django/Celery app experiences connection errors leading to task failures and closed connections.
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/2695
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 applied if the application relies on immediate disconnection behavior.
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
- 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.