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 2019/10/17 13:28:07 UTC

[GitHub] [pulsar] massakam opened a new pull request #5408: [pulsar-broker] Fix bug that namespace policies does not take effect due to NPE

massakam opened a new pull request #5408: [pulsar-broker] Fix bug that namespace policies does not take effect due to NPE
URL: https://github.com/apache/pulsar/pull/5408
 
 
   ### Motivation
   
   When produce/consume permissions for a role on a namespace are revoked, producers and consumers connected to the topic under the namespace using that role should be disconnected from the broker. However, I noticed that producers/consumers can stay connected in some topics even if the permissions are revoked.
   
   As a result of the investigation, I found that NPE was thrown in the following line:
   https://github.com/apache/pulsar/blob/094ebf7af8d0bb27bd9df3bcea2dba4e9ba204fc/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java#L273
   
   In subscriptions that consumer has never connected to since the broker started, the dispatcher has not been initialized, so `subscription.getDispatcher()` returns null.
   
   As a result, the process of `PersistentTopic#onPoliciesUpdate()` is aborted.
   https://github.com/apache/pulsar/blob/094ebf7af8d0bb27bd9df3bcea2dba4e9ba204fc/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java#L1668-L1682
   
   ### Modifications
   
   Before calling a dispatcher method, make sure that the dispatcher is not 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services