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

[pulsar-storm] Fix NPE while emitting next tuple #3991

Merged
merged 2 commits into from
Apr 9, 2019

Conversation

rdhabalia
Copy link
Contributor

Motivation

[PulsarSpout] removes messages from pendingMessageRetries but it doesn't remove from the failedMessages queue because of that PulsarSpout throws NPE while emitting next tuple

stack-trace with old pulsar-storm lib: 1.20
2019-04-05 18:49:58.240 b.s.util CmsSpout_[1 1] [INFO] Async loop Stacktrace is: {} java.lang.NullPointerException
    at org.apache.pulsar.storm.PulsarSpout.emitNextAvailableTuple(PulsarSpout.java:176)
    at org.apache.pulsar.storm.PulsarSpout.nextTuple(PulsarSpout.java:160)
    at backtype.storm.daemon.executor$fn__7365$fn__7380$fn__7411.invoke(executor.clj:577)
    at backtype.storm.util$async_loop$fn__551.invoke(util.clj:491)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.lang.Thread.run(Thread.java:748)
```

@rdhabalia rdhabalia added this to the 2.3.2 milestone Apr 5, 2019
@rdhabalia rdhabalia self-assigned this Apr 5, 2019
Copy link
Contributor

@jai1 jai1 left a comment

Choose a reason for hiding this comment

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

Some small suggestions - else LGTM


while ((msg = failedMessages.peek()) != null) {
MessageRetries messageRetries = pendingMessageRetries.get(msg.getMessageId());
if (messageRetries != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this if statement to a separate function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wouldn't much worry about it because this piece of code is not being reused and nextTuple anyway is calling emitNextAvailableTuple and I don't think we want to do another method call for this small logic.


// messageRetries is null because messageRetries is already acked and removed from pendingMessageRetries
// then remove it from failed message queue as well.
failedMessages.remove();
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a debug log here, in case people complain that their messages are not delivered or redelivered.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes..let me add it.

@merlimat
Copy link
Contributor

merlimat commented Apr 8, 2019

run integration tests

@sijie sijie merged commit 12de91f into apache:master Apr 9, 2019
@sijie sijie added the type/bug The PR fixed a bug or issue reported a bug label Apr 9, 2019
@merlimat merlimat modified the milestones: 2.3.2, 2.4.0 May 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants