You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/06/21 20:56:40 UTC

[GitHub] [bookkeeper] dlg99 opened a new pull request, #3350: Fix: NPE in RackawareEnsemblePlacementPolicyImpl logged by AutoRecovery

dlg99 opened a new pull request, #3350:
URL: https://github.com/apache/bookkeeper/pull/3350

   ### Motivation
   
   AR keeps on logging NPE during rereplication:
   
   ```
   [ReplicationWorker] WARN  org.apache.bookkeeper.client.RackawareEnsemblePlacementPolicyImpl - Received exception while trying to get network location of bookie: ...
   java.lang.NullPointerException: null 
   ```
   
   The NPE seems to be easily avoidable, no need to throw exception and log it just to ignore.
   
   ### Changes
   
   Added check for bookie being present in the knownBookies map before accessing it.
   


-- 
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: issues-unsubscribe@bookkeeper.apache.org

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


[GitHub] [bookkeeper] zymap merged pull request #3350: Fix: NPE in RackawareEnsemblePlacementPolicyImpl logged by AutoRecovery

Posted by GitBox <gi...@apache.org>.
zymap merged PR #3350:
URL: https://github.com/apache/bookkeeper/pull/3350


-- 
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: issues-unsubscribe@bookkeeper.apache.org

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


[GitHub] [bookkeeper] merlimat commented on a diff in pull request #3350: Fix: NPE in RackawareEnsemblePlacementPolicyImpl logged by AutoRecovery

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


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java:
##########
@@ -1026,7 +1026,11 @@ public PlacementPolicyAdherence isEnsembleAdheringToPlacementPolicy(List<BookieI
             for (int j = 0; j < writeQuorumSize; j++) {
                 bookie = ensembleList.get((i + j) % ensembleSize);
                 try {
-                    racksInQuorum.add(knownBookies.get(bookie).getNetworkLocation());
+                    if (knownBookies.containsKey(bookie)) {
+                        racksInQuorum.add(knownBookies.get(bookie).getNetworkLocation());

Review Comment:
   nit: we could check on the map one single time: 
   
   ```java
   String kb = knownBookies.get(bookie);
   if (kb != null) {
      ///... 
   }
   ```



-- 
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: issues-unsubscribe@bookkeeper.apache.org

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