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 Pipeline error #2446

Open
gethvi opened this issue Jan 22, 2024 · 3 comments
Open

Redis Pipeline error #2446

gethvi opened this issue Jan 22, 2024 · 3 comments

Comments

@gethvi
Copy link
Contributor

gethvi commented Jan 22, 2024

On some occasions (after restarting Redis) connection to Redis is refused and this exception is raised:

File "/opt/venv/lib/python3.9/site-packages/intelmq/lib/pipeline.py", line 311, in count_queued_messages
queue_dict[queue] = self.pipe.llen(queue)
File "/opt/venv/lib/python3.9/site-packages/redis/commands/core.py", line 2668, in llen
return self.execute_command("LLEN", name)
File "/opt/venv/lib/python3.9/site-packages/redis/client.py", line 1258, in execute_command
return conn.retry.call_with_retry(
File "/opt/venv/lib/python3.9/site-packages/redis/retry.py", line 49, in call_with_retry
fail(error)
File "/opt/venv/lib/python3.9/site-packages/redis/client.py", line 1262, in <lambda>
lambda error: self._disconnect_raise(conn, error),
File "/opt/venv/lib/python3.9/site-packages/redis/client.py", line 1248, in _disconnect_raise
raise error
File "/opt/venv/lib/python3.9/site-packages/redis/retry.py", line 46, in call_with_retry
return do()
File "/opt/venv/lib/python3.9/site-packages/redis/client.py", line 1259, in <lambda>
lambda: self._send_command_parse_response(
File "/opt/venv/lib/python3.9/site-packages/redis/client.py", line 1235, in _send_command_parse_response
return self.parse_response(conn, command_name, **options)
File "/opt/venv/lib/python3.9/site-packages/redis/client.py", line 1275, in parse_response
response = connection.read_response()
File "/opt/venv/lib/python3.9/site-packages/redis/connection.py", line 865, in read_response
response = self._parser.read_response(disable_decoding=disable_decoding)
File "/opt/venv/lib/python3.9/site-packages/redis/connection.py", line 346, in read_response
result = self._read_response(disable_decoding=disable_decoding)
File "/opt/venv/lib/python3.9/site-packages/redis/connection.py", line 369, in _read_response
raise error
redis.exceptions.BusyLoadingError: Redis is loading the dataset in memory

This just means we should just wait for a while for Redis to load the dataset in memory, not necessarily throw this on the user.

This particular case is from intelmq manager calling the command: sudo -u intelmq intelmqctl --type json list queues-and-status.

@kamil-certat
Copy link
Contributor

Hmm, I believe that while bots should wait, the intelmqctl is a one-time tool, so it in my opinion should end with a user-friendly command indicating starting Redis. On the other hand, the API wrapper should handle it gracefully, and just retry. What do you think?

@aaronkaplan
Copy link
Member

Well, for some intelmqctl is a CLI "API" ;-)

@gethvi
Copy link
Contributor Author

gethvi commented Feb 7, 2024

Hmm, I believe that while bots should wait, the intelmqctl is a one-time tool, so it in my opinion should end with a user-friendly command indicating starting Redis. On the other hand, the API wrapper should handle it gracefully, and just retry. What do you think?

I agree that one-time tool should probably just notify the user that Redis is not (yet) ready and that the user should wait and try again.

The API wrapper should probably wait for a little while, but eventually do the same really. Redis can be unavailable for a quite a while if the dataset is big (or if it crashes again, this happend to us when redis - in docker container - ran out of memory).

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

4 participants