Skip to content

Commit

Permalink
Fix: deadlock while closing non-shared consumer (apache#1591)
Browse files Browse the repository at this point in the history
* Fix: deadlock while closing non-shared consumer

* removing consumer async cause failure in unsubscribe. so, remove subscription async from topic
  • Loading branch information
rdhabalia authored and merlimat committed Apr 17, 2018
1 parent b7fe671 commit 39112f4
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
}

Expand Down

0 comments on commit 39112f4

Please sign in to comment.