Repository navigation
[fix] [broker] Fix thousands orphan PersistentTopic caused OOM - #21540
Conversation
| persistentTopic.stopReplProducers() | ||
| .whenCompleteAsync((v, exception) -> { | ||
| topics.remove(topic, topicFuture); | ||
| persistentTopic.close(); |
There was a problem hiding this comment.
Aha, I wanted to fix it there before.
If you chose the topic close method. You don't need the following codes. Because topic#close already does it.
persistentTopic.getTransactionBuffer()
.closeAsync()
.exceptionally(t -> {
log.error("[{}] Close transactionBuffer failed", topic, t);
return null;
});
persistentTopic.stopReplProducers()
There was a problem hiding this comment.
Plus, please give good log information if the closing operation has errors. :)
There was a problem hiding this comment.
Aha, I wanted to fix it there before.
Yes, it is #21445
If you chose the topic close method. You don't need the following codes. Because topic#close already does it.
Plus, please give good log information if the closing operation has errors. :)
Sure, fixed.
|
/pulsarbot rerun-failure-checks |
…rokerService.java Co-authored-by: Penghui Li <[email protected]>
…rokerService.java Co-authored-by: Penghui Li <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #21540 +/- ##
============================================
- Coverage 73.27% 73.26% -0.01%
- Complexity 32676 32689 +13
============================================
Files 1892 1892
Lines 140632 140710 +78
Branches 15467 15480 +13
============================================
+ Hits 103044 103090 +46
- Misses 29497 29521 +24
- Partials 8091 8099 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
(cherry picked from commit ea1fc0f)
(cherry picked from commit ea1fc0f)
Motivation
In the current implementation, the Broker just removes
topicFuturefrom the mappingBrokerService.topicsand never closes it[1].The orphan topics will be depended on by
SystemTopicBasedTopicPoliciesService.listeners, which is for notice of topic policy changes. This issue would cause OOM[2].[1]: https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java#L1725-L1748
... persistentTopic.stopReplProducers().whenCompleteAsync((v, exception) -> { topics.remove(topic, topicFuture); }, executor()); }).exceptionally((ex) -> { ... persistentTopic.stopReplProducers().whenCompleteAsync((v, exception) -> { topics.remove(topic, topicFuture); topicFuture.completeExceptionally(ex); }, executor()); ... });[2]: Thousands of orphan PersistentTopics

Modifications
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: x