-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
bugBugBug
Description
Version: 4.0.2
Platform: Python 3.9.7 on Fedora 34
Description: Steps to reproduce:
- Make redis establish a connection. For instance, in a local setting:
>>> from redis import Redis()
>>> redis = Redis()
>>> redis.get("something")
- Now there's a connection in the pool. The connection gets killed somehow. For instance:
$ sudo ss -K dst [::1] dport = redis
- Execute anything else:
>>> 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
The same happens if there's a firewall that resets the connection, but then a ConnectionResetError
is obtained instead. This doesn't happen with v3.5.3, which automatically detects the loss of connection and sets up a new one.