This is an automated email from the ASF dual-hosted git repository. chenhang pushed a commit to branch branch-4.17 in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
commit b01e59320379704969a3b20854f9f77ee5fed030 Author: Yan Zhao <[email protected]> AuthorDate: Wed Jul 31 11:16:58 2024 +0800 Fix ReadOnlyLedgerHandle leak issue when checkAllLedgers. (#4468) When the Auditor checkAllledgers, it will open the ledger with NoRecovery mode, it will register the listeners to the AbstractZkLedgerManager#listeners. The listener won't be removed if we don't close the ReadOnlyLedgerHandle, so there will be lots of listeners in the heap memory. The heap dump: <img width="1572" alt="image" src="https://github.com/user-attachments/assets/8b4cd6d3-b7bf-4ef2-9c47-2e076bdbbba0"> (cherry picked from commit 999cd0f2ab14404be4d6c24e388456dbe56bb1a8) --- .../org/apache/bookkeeper/replication/AuditorCheckAllLedgersTask.java | 1 + 1 file changed, 1 insertion(+) diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorCheckAllLedgersTask.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorCheckAllLedgersTask.java index 914f8ceed3..e073fce000 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorCheckAllLedgersTask.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorCheckAllLedgersTask.java @@ -211,6 +211,7 @@ public class AuditorCheckAllLedgersTask extends AuditorTask { auditorStats.getNumFragmentsPerLedger().registerSuccessfulValue(lh.getNumFragments()); auditorStats.getNumBookiesPerLedger().registerSuccessfulValue(lh.getNumBookies()); auditorStats.getNumLedgersChecked().inc(); + lh.closeAsync(); }); } else if (BKException.Code.NoSuchLedgerExistsOnMetadataServerException == rc) { if (LOG.isDebugEnabled()) {
