Jump to solution
Verify

The Fix

pip install redis==7.1.0

Based on closed redis/redis-py issue #1772 · PR/commit linked

Production note: Watch p95/p99 latency and retry volume; timeouts can turn into retry storms and duplicate side-effects.

Jump to Verify Open PR/Commit
@@ -1303,7 +1303,7 @@ def get_connection(self, command_name, *keys, **options): if connection.can_read(): raise ConnectionError("Connection has data") - except ConnectionError: + except (ConnectionError, OSError): connection.disconnect()
repro.py
>> redis.get("something") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/***/.local/lib/python3.9/site-packages/redis/commands/core.py", line 1023, in get return self.execute_command('GET', name) File "/home/***/.local/lib/python3.9/site-packages/redis/client.py", line 1068, in execute_command conn = self.connection or pool.get_connection(command_name, **options) File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 1179, in get_connection if connection.can_read(): File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 743, in can_read return self._parser.can_read(timeout) File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 315, in can_read return self._buffer and self._buffer.can_read(timeout) File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 224, in can_read self._read_from_socket(timeout=timeout, File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 192, in _read_from_socket data = self._sock.recv(socket_read_size) ConnectionAbortedError: [Errno 103] Software caused connection abort
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install redis==7.1.0\nWhen NOT to use: This fix should not be applied if the connection handling logic is fundamentally altered elsewhere.\n\n

Why This Fix Works in Production

  • Trigger: >> redis.get("something")
  • Mechanism: The connection pool does not handle OSError exceptions, leading to failures on connection resets
  • Why the fix works: Modifies the get_connection method to catch OSError in addition to ConnectionError, allowing the connection pool to recover from connection issues like ConnectionResetError and ConnectionAbortedError. (first fixed release: 7.1.0).
Production impact:
  • If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).

Why This Breaks in Prod

  • Shows up under Python 3.9.7 in real deployments (not just unit tests).
  • The connection pool does not handle OSError exceptions, leading to failures on connection resets
  • Surfaces as: >> redis.get("something")

Proof / Evidence

  • GitHub issue: #1772
  • Fix PR: https://github.com/redis/redis-py/pull/1832
  • 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.34

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“The main problem here is that the built-in ConnectionError has BrokenPipeError, ConnectionAbortedError, ConnectionRefusedError and ConnectionResetError as subclasses”
@Enchufa2 · 2021-12-03 · source
“does running CLIENT KILL have the same effect as ss -K or is Redis doing something extra on CLIENT KILL that allows for cleanup on…”
@Andrew-Chen-Wang · 2021-12-02 · source
“CLIENT KILL closes the connection gracefully. redis 3.5.3 and 4.0.2 do not fail after a CLIENT KILL, aioredis does fail.”
@Enchufa2 · 2021-12-03 · source
“> Ah good catch! We’re these part of socket.error before? I think so.”
@Enchufa2 · 2021-12-03 · source

Failure Signature (Search String)

  • >> redis.get("something")

Error Message

Stack trace
error.txt
Error Message ------------- >> redis.get("something") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/***/.local/lib/python3.9/site-packages/redis/commands/core.py", line 1023, in get return self.execute_command('GET', name) File "/home/***/.local/lib/python3.9/site-packages/redis/client.py", line 1068, in execute_command conn = self.connection or pool.get_connection(command_name, **options) File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 1179, in get_connection if connection.can_read(): File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 743, in can_read return self._parser.can_read(timeout) File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 315, in can_read return self._buffer and self._buffer.can_read(timeout) File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 224, in can_read self._read_from_socket(timeout=timeout, File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 192, in _read_from_socket data = self._sock.recv(socket_read_size) ConnectionAbortedError: [Errno 103] Software caused connection abort

Minimal Reproduction

repro.py
>> redis.get("something") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/***/.local/lib/python3.9/site-packages/redis/commands/core.py", line 1023, in get return self.execute_command('GET', name) File "/home/***/.local/lib/python3.9/site-packages/redis/client.py", line 1068, in execute_command conn = self.connection or pool.get_connection(command_name, **options) File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 1179, in get_connection if connection.can_read(): File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 743, in can_read return self._parser.can_read(timeout) File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 315, in can_read return self._buffer and self._buffer.can_read(timeout) File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 224, in can_read self._read_from_socket(timeout=timeout, File "/home/***/.local/lib/python3.9/site-packages/redis/connection.py", line 192, in _read_from_socket data = self._sock.recv(socket_read_size) ConnectionAbortedError: [Errno 103] Software caused connection abort

Environment

  • Python: 3.9.7

What Broke

Connections fail to recover, causing timeouts and errors when accessing Redis.

Why It Broke

The connection pool does not handle OSError exceptions, leading to failures on connection resets

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install redis==7.1.0

When NOT to use: This fix should not be applied if the connection handling logic is fundamentally altered elsewhere.

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/1832

First fixed release: 7.1.0

Last verified: 2026-02-07. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix should not be applied if the connection handling logic is fundamentally altered elsewhere.

Verify Fix

verify
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

VersionStatus
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.