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 2020/08/24 22:22:53 UTC

[GitHub] [pulsar] sijie commented on a change in pull request #7841: [broker] Fix deadlock when adding consumer

sijie commented on a change in pull request #7841:
URL: https://github.com/apache/pulsar/pull/7841#discussion_r475927230



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java
##########
@@ -140,6 +141,38 @@ protected boolean isProducersExceeded() {
         return false;
     }
 
+    protected boolean isConsumersExceededOnTopic() {
+        Policies policies;
+        try {
+            // Use getDataIfPresent from zk cache to make the call non-blocking and prevent deadlocks
+            policies = brokerService.pulsar().getConfigurationCache().policiesCache()
+                    .getDataIfPresent(AdminResource.path(POLICIES, TopicName.get(topic).getNamespace()));
+
+            if (policies == null) {
+                policies = new Policies();
+            }
+        } catch (Exception e) {

Review comment:
       should we log an error message?




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