You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/04/08 12:55:35 UTC

[GitHub] [pulsar] lordcheng10 opened a new pull request, #15090: fix npe in addComplete

lordcheng10 opened a new pull request, #15090:
URL: https://github.com/apache/pulsar/pull/15090

   ### Motivation
   fix npe in addComplete,the exception log of the broker is as follows:
   
   19:31:14.341 [BookKeeperClientWorker-OrderedExecutor-31-0] ERROR org.apache.bookkeeper.common.util.SafeRunnable - Unexpected throwable caught
   java.lang.NullPointerException: null
           at org.apache.bookkeeper.mledger.impl.OpAddEntry.addComplete(OpAddEntry.java:153) ~[org.apache.pulsar-managed-ledger-2.8.1.2.jar:2.8.1.2]
           at org.apache.bookkeeper.client.AsyncCallback$AddCallback.addCompleteWithLatency(AsyncCallback.java:92) ~[org.apache.bookkeeper-bookkeeper-server-4.14.2.1.jar:4.14.2.1]
           at org.apache.bookkeeper.client.PendingAddOp.submitCallback(PendingAddOp.java:431) ~[org.apache.bookkeeper-bookkeeper-server-4.14.2.1.jar:4.14.2.1]
           at org.apache.bookkeeper.client.LedgerHandle.errorOutPendingAdds(LedgerHandle.java:1799) ~[org.apache.bookkeeper-bookkeeper-server-4.14.2.1.jar:4.14.2.1]
           at org.apache.bookkeeper.client.LedgerHandle$5.safeRun(LedgerHandle.java:574) ~[org.apache.bookkeeper-bookkeeper-server-4.14.2.1.jar:4.14.2.1]
           at org.apache.bookkeeper.common.util.SafeRunnable.run(SafeRunnable.java:36) [org.apache.bookkeeper-bookkeeper-common-4.14.2.1.jar:4.14.2.1]
           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.
   
   Need to update docs? 
   
   - [ ] `doc-required` 
   (Your PR needs to update docs and you will update later)
     
   - [x] `no-need-doc` 
   (Please explain why)
     
   - [ ] `doc` 
   (Your PR contains doc changes)
   
   - [ ] `doc-added`
   (Docs have been already added)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] Jason918 commented on a diff in pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
Jason918 commented on code in PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#discussion_r846574358


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java:
##########
@@ -165,7 +165,7 @@ public void addComplete(int rc, final LedgerHandle lh, long entryId, Object ctx)
             return;
         }
 
-        if (ledger.getId() != lh.getId()) {
+        if (lh != null && ledger != null && ledger.getId() != lh.getId()) {
             log.warn("[{}] ledgerId {} doesn't match with acked ledgerId {}", ml.getName(), ledger.getId(), lh.getId());
         }
         checkArgument(ledger.getId() == lh.getId(), "ledgerId %s doesn't match with acked ledgerId %s", ledger.getId(),

Review Comment:
   `ledger` and `lh` is used here too.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] poorbarcode commented on a diff in pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
poorbarcode commented on code in PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#discussion_r846292223


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java:
##########
@@ -165,7 +165,7 @@ public void addComplete(int rc, final LedgerHandle lh, long entryId, Object ctx)
             return;
         }
 
-        if (ledger.getId() != lh.getId()) {
+        if (lh != null && ledger != null && ledger.getId() != lh.getId()) {

Review Comment:
   Field `ledgerId` of `LedgerHandle.java` is not wrap class, will not throw NullpointerException.
   
   Mabey `ledger` or `lh` is null ? 
   
   If `ledger` is null, that is not a simple null-pointer problem, could you explain the case ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] lordcheng10 commented on pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#issuecomment-1093584661

   /pulsarbot run-failure-checks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] poorbarcode commented on a diff in pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
poorbarcode commented on code in PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#discussion_r846292223


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java:
##########
@@ -165,7 +165,7 @@ public void addComplete(int rc, final LedgerHandle lh, long entryId, Object ctx)
             return;
         }
 
-        if (ledger.getId() != lh.getId()) {
+        if (lh != null && ledger != null && ledger.getId() != lh.getId()) {

Review Comment:
   Field `ledgerId` of `LedgerHandle.java` is not wrap class, will not throw NullpointerException.
   
   Maybe `ledger` or `lh` is null ? 
   
   If `ledger` is null, that is not a simple null-pointer problem, could you provide more information



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] lordcheng10 commented on pull request #15090: Fix npe in org.apache.bookkeeper.mledger.impl.OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#issuecomment-1093008410

   /pulsarbot run-failure-checks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] lordcheng10 commented on pull request #15090: Fix npe in org.apache.bookkeeper.mledger.impl.OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#issuecomment-1092957485

   /pulsarbot run-failure-checks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] tisonkun closed pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
tisonkun closed pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete
URL: https://github.com/apache/pulsar/pull/15090


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] lordcheng10 commented on pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#issuecomment-1093581954

   /pulsarbot run-failure-checks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] github-actions[bot] commented on pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#issuecomment-1121783415

   The pr had no activity for 30 days, mark with Stale label.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] lordcheng10 commented on pull request #15090: Fix npe in org.apache.bookkeeper.mledger.impl.OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#issuecomment-1092832364

   @hangc0276 @codelipenghui @eolivelli PTAL,thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] lordcheng10 commented on pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#issuecomment-1093557901

   /pulsarbot run-failure-checks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] lordcheng10 commented on pull request #15090: Fix npe in org.apache.bookkeeper.mledger.impl.OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#issuecomment-1093011904

   /pulsarbot run-failure-checks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] merlimat commented on a diff in pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
merlimat commented on code in PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#discussion_r846562410


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java:
##########
@@ -165,7 +165,7 @@ public void addComplete(int rc, final LedgerHandle lh, long entryId, Object ctx)
             return;
         }
 
-        if (ledger.getId() != lh.getId()) {
+        if (lh != null && ledger != null && ledger.getId() != lh.getId()) {

Review Comment:
   I'm not sure this would solve the problem as it appears to be a race condition where the object is being recycled.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] poorbarcode commented on a diff in pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
poorbarcode commented on code in PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#discussion_r846292223


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java:
##########
@@ -165,7 +165,7 @@ public void addComplete(int rc, final LedgerHandle lh, long entryId, Object ctx)
             return;
         }
 
-        if (ledger.getId() != lh.getId()) {
+        if (lh != null && ledger != null && ledger.getId() != lh.getId()) {

Review Comment:
   Field `ledgerId` of `LedgerHandle.java` is not wrap class, will not throw NullpointerException.
   
   Mabey `ledger` or `lh` is null ? 
   
   If ledger` is null, that is not a simple null-pointer problem, could you explain the case ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] lordcheng10 commented on pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#issuecomment-1093707065

   > Can you find the root cause of this NPE?
   
   OK. I will


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] github-actions[bot] commented on pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#issuecomment-1150594356

   The pr had no activity for 30 days, mark with Stale label.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] lordcheng10 commented on pull request #15090: Fix npe in org.apache.bookkeeper.mledger.impl.OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#issuecomment-1092938228

   /pulsarbot run-failure-checks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] poorbarcode commented on a diff in pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
poorbarcode commented on code in PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#discussion_r846292223


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java:
##########
@@ -165,7 +165,7 @@ public void addComplete(int rc, final LedgerHandle lh, long entryId, Object ctx)
             return;
         }
 
-        if (ledger.getId() != lh.getId()) {
+        if (lh != null && ledger != null && ledger.getId() != lh.getId()) {

Review Comment:
   Field `ledgerId` of `LedgerHandle.java` is not wrap class, will not throw NullpointerException.
   
   Mabey `ledger` or `lh` is null ? 
   
   If `ledger` is null, that is not a simple null-pointer problem, could you provide more information



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] lordcheng10 commented on pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#issuecomment-1093097280

   /pulsarbot run-failure-checks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] tisonkun commented on pull request #15090: [fix][broker] Fix npe in OpAddEntry#addComplete

Posted by GitBox <gi...@apache.org>.
tisonkun commented on PR #15090:
URL: https://github.com/apache/pulsar/pull/15090#issuecomment-1345240313

   Closed as stale, conflict, and no consensus. Please rebase and resubmit the patch if it's still relevant.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org