Skip to content

fix npe in handleAddFailure - #14606

Closed
lordcheng10 wants to merge 1 commit into
apache:masterfrom
lordcheng10:fix_npe_handleAdd
Closed

lordcheng10 wants to merge 1 commit into
apache:masterfrom
lordcheng10:fix_npe_handleAdd

Conversation

@lordcheng10

@lordcheng10 lordcheng10 commented Mar 8, 2022 •

Copy link
Copy Markdown
Contributor

Motivation

The npe was found in the broker log, the log is as follows:

3:29:20.111 [BookKeeperClientWorker-OrderedExecutor-37-0] ERROR org.apache.bookkeeper.common.util.SafeRunnable - Unexpected throwable caught
java.lang.NullPointerException: null
at org.apache.bookkeeper.mledger.impl.OpAddEntry.lambda$handleAddFailure$0(OpAddEntry.java:291) ~[org.apache.pulsar-managed-ledger-2.8.1.2.jar:2.8.1.2]
at org.apache.bookkeeper.mledger.util.SafeRun$1.safeRun(SafeRun.java:32) ~[org.apache.pulsar-managed-ledger-2.8.1.2.jar:2.8.1.2]
at org.apache.bookkeeper.common.util.SafeRunnable.run(SafeRunnable.java:36) [org.apache.bookkeeper-bookkeeper-common-4.14.2.jar:4.14.2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_144]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [io.netty-netty-common-4.1.66.Final.jar:4.1.66.Final]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]

Documentation

Check the box below or label this PR directly (if you have committer privilege).

Need to update docs?

  • doc-required

    (If you need help on updating docs, create a doc issue)

  • no-need-doc

    (Please explain why)

  • doc

    (If this PR contains doc changes)

@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Mar 8, 2022
@lordcheng10 lordcheng10 changed the title fix npe of handleAddFailure fix npe in handleAddFailure Mar 8, 2022
// Force the creation of a new ledger. Doing it in a background thread to avoid acquiring ML lock
// from a BK callback.
finalMl.ledgerClosed(lh);
if (finalMl != null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

how can finalMl ever be null? Wouldn't finalMl.getName() also fail?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks like a thread safety issue again where the solution isn't to suppress the NPE.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

or perhaps #12103 already fixed the issue and you are running a version without that fix? @lordcheng10 can you confirm if you have changes for #12103?

@lhotari lhotari Mar 8, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@lhotari

lhotari commented Mar 8, 2022

Copy link
Copy Markdown
Member

Closing since this issue is already fixed by #12103

@lhotari lhotari closed this Mar 8, 2022
@lordcheng10

Copy link
Copy Markdown
Contributor Author

already

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants