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

Avoid incorrect call to the previous reply's callback #1040

Merged
merged 2 commits into from
Jan 28, 2022

Conversation

bjosv
Copy link
Contributor

@bjosv bjosv commented Jan 21, 2022

When multiple replies are parsed from a socket in one read;
a previously found callback might get reused when the current reply has no known callback.

This case is triggered in the added testcase test_pubsub_multiple_channels(),
which unsubscribes to the subscribed channels A, B and a non-subscribed channel X.
Without this correction a callback for wrong channel is called.

  • For the command unsubscribe B X A, B's callback is called when handling the response for X.
  • Now this is not done, i.e. there is no callback called for X.

Monitoring was using this trait to repush its callback when all replies was parsed.
This is changed to repush for each message instead, which now also is tested with a new testcase.

When multiple replies are parsed from a socket in one read
a previously found callback might get reused when the current
reply has no known callback.

This can be triggered by the added testcase which unsubscribe to
subscribed (A,B) and a non-subscribed channel (X).
Without this correction a callback for wrong channel is called.
-  In 'unsubscribe B X A', B's callback is called when handling X.
-  Now this is not done, i.e. there is no callback called for X.
MONITORING used the same callback for all replies while parsing
multiple responses. This handling was changed to avoid calling
the wrong callback in some scenarios.
Now also change monitorings repush to work with this change.

Includes an added async monitoring testcase.
@michael-grunder michael-grunder merged commit be41ed6 into redis:master Jan 28, 2022
@michael-grunder
Copy link
Collaborator

Merged, thanks!

@bjosv bjosv deleted the avoid-callback-reuse branch January 28, 2022 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants