pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [pulsar] massakam commented on a change in pull request #7690: [proxy] Fix deadlock in pulsar proxy
Date Thu, 30 Jul 2020 08:26:59 GMT

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



Mime
View raw message