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

fix: handle 0 sized collector batches in PostOffice #777

Merged
merged 1 commit into from
Oct 9, 2023
Merged

fix: handle 0 sized collector batches in PostOffice #777

merged 1 commit into from
Oct 9, 2023

Conversation

MikeDombo
Copy link
Contributor

This change is attempting to resolve #750 where the call to retain is 0 and therefore countBatches must have returned 0. I know that this change will absolutely avoid the error, however, I'm not clear on why the number of batches would be 0 while this code is running. In this change, I simply treat it exactly the same as the above case where there are no subscriptions (and thus no work to do).

@hylkevds
Copy link
Collaborator

hylkevds commented Oct 2, 2023

It seems this can happen when a message is sent with the duplicate flag, but the original message was successfully sent to all subscribed clients. In this case the failedClients Set is empty and as a result the collector collects no actions.

The other way this can happen is if a dup message is sent, but all failed clients have since un-subscribed from the topic. In this case filterClients is not empty, but there are no matches between the subscription list and the filterClients Set.

Your fix looks good to me.

Copy link
Collaborator

@hylkevds hylkevds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@andsel andsel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andsel andsel merged commit 8ab1c91 into moquette-io:main Oct 9, 2023
4 checks passed
@andsel andsel added the v0.18.0 label Oct 9, 2023
@zhengyuan-cn
Copy link

oh,,,It's happened on my application.

RotherStefan pushed a commit to smart2i/moquette that referenced this pull request Feb 15, 2024
This change is attempting to resolve moquette-io#750 where the call to retain is 0 and therefore countBatches must have returned 0. I know that this change will absolutely avoid the error, however, I'm not clear on why the number of batches would be 0 while this code is running. In this change, I simply treat it exactly the same as the above case where there are no subscriptions (and thus no work to do).

(cherry picked from commit 8ab1c91)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IllegalArgumentException thrown from PostOffice class
4 participants