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/07/30 08:26:59 UTC

[GitHub] [pulsar] massakam commented on a change in pull request #7690: [proxy] Fix deadlock in pulsar proxy

massakam commented on a change in pull request #7690:
URL: https://github.com/apache/pulsar/pull/7690#discussion_r462826547



##########
File path: pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/util/ZookeeperCacheLoader.java
##########
@@ -78,11 +84,14 @@ public LoadManagerReport deserialize(String key, byte[] content) throws Exceptio
 
         this.availableBrokersCache = new ZooKeeperChildrenCache(getLocalZkCache(), LOADBALANCE_BROKERS_ROOT);
         this.availableBrokersCache.registerListener((path, brokerNodes, stat) -> {
-            try {
-                updateBrokerList(brokerNodes);
-            } catch (Exception e) {
-                log.warn("Error updating broker info after broker list changed.", e);
-            }
+            // Run in a separate thread to avoid deadlocks
+            brokerListUpdater.execute(() -> {
+                try {
+                    updateBrokerList(brokerNodes);

Review comment:
       Made the `updateBrokerList()` method asynchronous.




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