This is an automated email from the ASF dual-hosted git repository.

jai1 pushed a commit to branch branch-1.22
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git


The following commit(s) were added to refs/heads/branch-1.22 by this push:
     new 1a31f91  Fix: deadlock while closing non-persistent topic
1a31f91 is described below

commit 1a31f91660de11060e0286e83ea35ef745e596f7
Author: Jai Asher <j...@ccs.neu.edu>
AuthorDate: Wed May 2 01:28:40 2018 -0700

    Fix: deadlock while closing non-persistent topic
---
 .../pulsar/broker/service/nonpersistent/NonPersistentTopic.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
index 44a9e14..5d6b4ba 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
@@ -462,8 +462,12 @@ public class NonPersistentTopic implements Topic {
 
         FutureUtil.waitForAll(futures).thenRun(() -> {
             log.info("[{}] Topic closed", topic);
-            brokerService.pulsar().getExecutor().submit(() -> 
brokerService.removeTopicFromCache(topic));
-            closeFuture.complete(null);
+            // unload topic iterates over topics map and removing from the map 
with the same thread creates deadlock.
+            // so, execute it in different thread
+            brokerService.executor().execute(() -> {
+                brokerService.removeTopicFromCache(topic);
+                closeFuture.complete(null);
+            });
         }).exceptionally(exception -> {
             log.error("[{}] Error closing topic", topic, exception);
             isFenced = false;

-- 
To stop receiving notification emails like this one, please contact
j...@apache.org.

Reply via email to