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/06/27 05:56:57 UTC

[GitHub] [pulsar] Technoboy- opened a new pull request, #16235: Fix NPE when drop backlog for time limit.

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: commits-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] Technoboy- commented on pull request #16235: [fix][broker] Fix NPE when drop backlog for time limit.

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

   > Is it able to add a test?
   > 
   > Maybe try to mock the managed ledger and let the `mLedger.getLedgerInfo` method return null.
   
   Really. it's hard to add a test. because there existed a race condition with PersistentTopic#slowestReaderTimeBasedBacklogQuotaCheck, see #15663.
   When broker do `monitorBacklogQuota `, it will first execute PersistentTopic#slowestReaderTimeBasedBacklogQuotaCheck, it will check the `mLedger.getLedgerInfo`. then to BacklogQuotaManager#dropBacklogForTimeLimit. we need to mock after PersistentTopic#slowestReaderTimeBasedBacklogQuotaCheck.
   
   It's the same issue with #15663, so using the same resolution for this issue.
   


-- 
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] codelipenghui merged pull request #16235: [fix][broker] Fix NPE when drop backlog for time limit.

Posted by GitBox <gi...@apache.org>.
codelipenghui merged PR #16235:
URL: https://github.com/apache/pulsar/pull/16235


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