jai1 closed pull request #1716: Fix: deadlock while closing non-shared consumer URL: https://github.com/apache/incubator-pulsar/pull/1716
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): 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 e742f148cb..9ed7f74902 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,8 +153,12 @@ public synchronized void removeConsumer(Consumer consumer) throws BrokerServiceE 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); + }); } } // invalid consumer remove will throw an exception ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services