Technoboy- opened a new pull request, #16235:
URL: https://github.com/apache/pulsar/pull/16235

   ### Motivation
   
   When broker do `monitorBacklogQuota`, there may throw NPE.
   ```
   2022-06-24T18:14:38,360-0400 [pulsar-backlog-quota-checker-29-1] ERROR 
org.apache.pulsar.broker.service.BacklogQuotaManager - 
[persistent://enmv/epnmccs-yang/ECLIPSE-epnmccs-yang-ms-east-partition-1] Error 
resetting cursor for slowest consumer [ENMV_CCS_SUBSCRIPTION]
   java.lang.NullPointerException: null
    at 
org.apache.pulsar.broker.service.BacklogQuotaManager.dropBacklogForTimeLimit(BacklogQuotaManager.java:247)
 
    at 
org.apache.pulsar.broker.service.BacklogQuotaManager.handleExceededBacklogQuota(BacklogQuotaManager.java:127)
 
    at 
org.apache.pulsar.broker.service.BrokerService.lambda$monitorBacklogQuota$78(BrokerService.java:1721)
 
    at java.util.Optional.ifPresent(Optional.java:183) ~[?:?]
    at 
org.apache.pulsar.broker.service.BrokerService.lambda$forEachTopic$77(BrokerService.java:1705)
 
    at 
org.apache.pulsar.common.util.collections.ConcurrentOpenHashMap$Section.forEach(ConcurrentOpenHashMap.java:544)
    at 
org.apache.pulsar.common.util.collections.ConcurrentOpenHashMap.forEach(ConcurrentOpenHashMap.java:272)
 
    at 
org.apache.pulsar.broker.service.BrokerService.forEachTopic(BrokerService.java:1703)
 
    at 
org.apache.pulsar.broker.service.BrokerService.monitorBacklogQuota(BrokerService.java:1714)
 
    
   ```
   
   Below is the related code : 
   
https://github.com/apache/pulsar/blob/a3f52891593e093c27b583094a1fbfd09bbbae1a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BacklogQuotaManager.java#L241-L257
   
   The root cause is that the slowest consumer ledgerId may be trimmed, so we 
need to check `ledgerInfo`.
   
   ### Documentation
   
   - [x] `doc-not-needed` 
   (Please explain why)
     


-- 
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