addisonj opened a new pull request #12097:
URL: https://github.com/apache/pulsar/pull/12097


   Since the release of Pulsar 2.8 and upgrade to BK 4.12, the default
   rackAwarePlacementPolicy has been failing with the following exception:
   
   ```
   org.apache.bookkeeper.client.RackawareEnsemblePlacementPolicyImpl - Failed 
to initialize DNS Resolver 
org.apache.pulsar.zookeeper.ZkBookieRackAffinityMapping, used default subnet 
resolver : java.lang.RuntimeException: java.lang.NullPointerException 
java.lang.NullPointerException
   ```
   
   This regression occured in commit 
https://github.com/apache/pulsar/commit/4c6026213b743a7f23ae2a5a6d37ee7404b066db
   
   The core of the issue is that `setConf` is called before
   `setBookieAddressResolver` has been set (see
   
https://github.com/apache/bookkeeper/blob/034ef8566ad037937a4d58a28f70631175744f53/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java#L264-L286)
   
   This results in the NPE.
   
   We are safe to simply not eagerly init the cache in setConf as the
   getRack call will re-check the cache.
   
   We also protect against this possible NPE for safety
   
   This is difficult to test directly but we should have an integration test to 
validate that PlacementPolicy is working as expected.
   
   CC @eolivelli 
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to