Skip to content

Commit b01e593

Browse files
horizonzyhangc0276
authored andcommitted
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 999cd0f)
1 parent c58fba7 commit b01e593

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorCheckAllLedgersTask.java

+1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ void checkAllLedgers() throws BKException, IOException, InterruptedException {
211211
auditorStats.getNumFragmentsPerLedger().registerSuccessfulValue(lh.getNumFragments());
212212
auditorStats.getNumBookiesPerLedger().registerSuccessfulValue(lh.getNumBookies());
213213
auditorStats.getNumLedgersChecked().inc();
214+
lh.closeAsync();
214215
});
215216
} else if (BKException.Code.NoSuchLedgerExistsOnMetadataServerException == rc) {
216217
if (LOG.isDebugEnabled()) {

0 commit comments

Comments
 (0)