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

[Issue 7878][broker]Fix NPE when acknowledge messages at the broker side #7937

Merged
merged 1 commit into from Aug 31, 2020
Merged

[Issue 7878][broker]Fix NPE when acknowledge messages at the broker side #7937

merged 1 commit into from Aug 31, 2020

Conversation

Technoboy-
Copy link
Contributor

No description provided.

@codelipenghui codelipenghui added this to the 2.7.0 milestone Aug 31, 2020
@codelipenghui codelipenghui merged commit af3a7af into apache:master Aug 31, 2020
@lhotari
Copy link
Member

lhotari commented Sep 4, 2020

@Technoboy- @codelipenghui @jiazhai Hi, I was looking at the fix for the NPE. It looks like the fix would silently by-pass any operations when dispatcher is null. Wouldn't skipping the operations cause issues in consistency? Is it ok to skip the operations? I guess it is, but I'm just trying to understand Pulsar coding style by following how it's developed. Therefore I'm asking these questions. Perhaps some day I'd be able to contribute too. :)
Just thinking out loud here. I don't mean to be rude.

There are 16 times that dispatcher != null is in the code of PersistentSubscription. Why is dispatcher null in the first place? Would there be a need to improve the design, for example have some kind of state machine / model that would help organize the code in a better way? It seems that the design isn't optimal if each time you call a method on dispatcher, you would have to do a null check. I'd assume that some kind of proxy pattern would encapsulate things in a better way.
(Another unrelated observation is that there are a lot of synchronized methods in the PersistentSubscription class, however I guess there isn't a lockfree design in Pulsar in general.)

@codelipenghui
Copy link
Contributor

codelipenghui commented Sep 4, 2020

@lhotari Thanks for the comment. This will not cause issues in consistency, this PR only add check for the acknowledge method. Currently, the acknowledgment is in a try best way.

for example have some kind of state machine / model that would help organize the code in a better way?

Sounds good. If you are interested in this part, feel free to push forward.

Another unrelated observation is that there are a lot of synchronized methods in the PersistentSubscription class, however I guess there isn't a lockfree design in Pulsar in general.

Yes, maybe this is the part that can be improved. Some seem to be unnecessary.

lbenc135 pushed a commit to lbenc135/pulsar that referenced this pull request Sep 5, 2020
lbenc135 pushed a commit to lbenc135/pulsar that referenced this pull request Sep 5, 2020
lbenc135 pushed a commit to lbenc135/pulsar that referenced this pull request Sep 5, 2020
wolfstudy pushed a commit that referenced this pull request Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants