-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Potential Command Duplication in _send_command_parse_response Retry Mechanism #3554
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
Comments
Hi @ManelCoutinhoSensei ! You have a point here, it doesn't makes sense to retry write operation on read failure, moreover it may lead to unintended disconnects because we have a data in a socket buffer that we doesn't process. We would take this issue into a count Line 1491 in ea01a30
|
If you don't want this "This means that any command with side effects (such as XADD) could be executed twice instead of just once, leading to unintended duplication." you need to either disable retries and handle them yourself or move all of that into repeatable transaction or whatever, in general case this is unsolvable problem. |
@excitoon, your explanation suggests that the retry system's limitations force users to disable it and manage retries themselves. However, the solution proposed in PR 3559 demonstrates that the duplication issue can be resolved within the existing framework. While the PR may not be perfect, it shows that addressing this problem without abandoning the built-in retry mechanism is indeed feasible. |
Follow up here |
Hi there,
I have a conceptual problem with how the
_send_command_parse_response
is being grouped:redis-py/redis/client.py
Lines 590 to 595 in ea01a30
My issue is that this method is called inside a retry mechanism:
redis-py/redis/client.py
Lines 623 to 628 in ea01a30
Which means that if the Redis container goes down after
send_command
and beforeparse_response
, the entire_send_command_parse_response
will be retried. This means that any command with side effects (such asXADD
) could be executed twice instead of just once, leading to unintended duplication.Would love to hear thoughts on potential fixes for this issue. Let me know if you need any additional details!
The text was updated successfully, but these errors were encountered: