merlimat closed pull request #1591: Fix: deadlock while closing non-shared consumer URL: https://github.com/apache/incubator-pulsar/pull/1591
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 a3e8a3467..3cface20d 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 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); + }); } } ---------------------------------------------------------------- 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