Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redis.exceptions.ConnectionError with 4.5.2 #2636

Closed
eldom9 opened this issue Mar 21, 2023 · 7 comments
Closed

redis.exceptions.ConnectionError with 4.5.2 #2636

eldom9 opened this issue Mar 21, 2023 · 7 comments

Comments

@eldom9
Copy link

eldom9 commented Mar 21, 2023

Version: redis==4.5.2

Platform: Python 3.11 on Alpine Linux with Redis 6.2

Description:
Since todays upgrade from redis 4.5.1 to 4.5.2 the following error log messages from my Django/Celery App which is using Redis as broker appeared:

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", line 1508, in <lambda>
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR lambda: command(*args, **kwargs),
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 1529, in try_read
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR return conn.read_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/connection.py", line 865, in read_response
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR response = self._parser.read_response(disable_decoding=disable_decoding)
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/connection.py", line 346, in read_response
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR result = self._read_response(disable_decoding=disable_decoding)
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/connection.py", line 356, in _read_response
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR raw = self._buffer.readline()
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/connection.py", line 259, in readline
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR self._read_from_socket()
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 212, in _read_from_socket
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
3/21/2023, 8:48:29 PM [APP/PROC/WEB/0] ERR redis.exceptions.ConnectionError: Connection closed by server.

Switching back to redis==4.5.1 resolves the issue.

@woutdenolf
Copy link
Contributor

woutdenolf commented Mar 24, 2023

Duplicate of #2629

Edit: or maybe not because from the trace it seems the socket connection was made.

@eldom9
Copy link
Author

eldom9 commented May 1, 2023

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.

@woutdenolf
Copy link
Contributor

woutdenolf commented May 1, 2023

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 the issue?

@woutdenolf
Copy link
Contributor

Could it be related to this issue: #2717?

@woutdenolf
Copy link
Contributor

Perhaps try whether this fixes the issue: #2695

@dvora-h
Copy link
Collaborator

dvora-h commented Jul 16, 2023

@eldom9 Does this issue still relevant or fixed already?

@dvora-h
Copy link
Collaborator

dvora-h commented Jan 21, 2024

Closing as there is no response.
If this is still relevant, please reopen.

@dvora-h dvora-h closed this as completed Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants