Skip to content

Commit

Permalink
Fix ReadOnlyLedgerHandle leak issue when checkAllLedgers. (#4468)
Browse files Browse the repository at this point in the history
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">
  • Loading branch information
horizonzy authored Jul 31, 2024
1 parent 7ab29e6 commit 999cd0f
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ void checkAllLedgers() throws BKException, IOException, InterruptedException {
auditorStats.getNumFragmentsPerLedger().registerSuccessfulValue(lh.getNumFragments());
auditorStats.getNumBookiesPerLedger().registerSuccessfulValue(lh.getNumBookies());
auditorStats.getNumLedgersChecked().inc();
lh.closeAsync();
});
} else if (BKException.Code.NoSuchLedgerExistsOnMetadataServerException == rc) {
if (LOG.isDebugEnabled()) {
Expand Down

0 comments on commit 999cd0f

Please sign in to comment.