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

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


The following commit(s) were added to refs/heads/master by this push:
     new 39112f4  Fix: deadlock while closing non-shared consumer (#1591)
39112f4 is described below

commit 39112f4f961aa711d249a78fc76f72494d37f346
Author: Rajan Dhabalia <rdhaba...@apache.org>
AuthorDate: Mon Apr 16 22:25:40 2018 -0700

    Fix: deadlock while closing non-shared consumer (#1591)
    
    * Fix: deadlock while closing non-shared consumer
    
    * removing consumer async cause failure in unsubscribe. so, remove 
subscription async from topic
---
 .../pulsar/broker/service/persistent/PersistentSubscription.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java
index a3e8a34..3cface2 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java
@@ -153,7 +153,11 @@ public class PersistentSubscription implements 
Subscription {
             if (!cursor.isDurable()) {
                 // If cursor is not durable, we need to clean up the 
subscription as well
                 close();
-                topic.removeSubscription(subName);
+                // when topic closes: it iterates through 
concurrent-subscription map to close each subscription. so,
+                // topic.remove again try to access same map which creates 
deadlock. so, execute it in different thread.
+                topic.getBrokerService().pulsar().getExecutor().submit(() ->{
+                    topic.removeSubscription(subName);
+                });
             }
         }
 

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

Reply via email to