Skip to content

Commit

Permalink
Fix deadlock during GC of non-persistent topic (#4003)
Browse files Browse the repository at this point in the history
  • Loading branch information
massakam authored and merlimat committed Apr 8, 2019
1 parent 0fc17cc commit 7a6f2cc
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,13 @@ private CompletableFuture<Void> delete(boolean failIfHasSubscriptions, boolean c
isFenced = false;
deleteFuture.completeExceptionally(ex);
} else {
brokerService.removeTopicFromCache(topic);
log.info("[{}] Topic deleted", topic);
deleteFuture.complete(null);
// topic GC 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);
log.info("[{}] Topic deleted", topic);
deleteFuture.complete(null);
});
}
});
} else {
Expand Down

0 comments on commit 7a6f2cc

Please sign in to comment.