Skip to content

Commit

Permalink
[fix][server]fix memory leak when closeRecovered,failed on clearing n…
Browse files Browse the repository at this point in the history
…ewEnsemblesFromRecovery (apache#3672)

Co-authored-by: lushiji <[email protected]>
(cherry picked from commit a19d849)
(cherry picked from commit bf18fc5)
  • Loading branch information
StevenLuMT authored and nicoloboschi committed Jan 11, 2023
1 parent 40348d7 commit a6ecf36
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,14 @@ CompletableFuture<Versioned<LedgerMetadata>> closeRecovered() {
return builder.withClosedState().withLastEntryId(lac).withLength(len).build();
},
this::setLedgerMetadata).run();
f.thenRun(() -> {
synchronized (metadataLock) {
newEnsemblesFromRecovery.clear();
}
});
f.whenComplete((result, exception) -> {
synchronized (metadataLock) {
newEnsemblesFromRecovery.clear();
}
if (exception != null) {
LOG.error("When closeRecovered,failed on clearing newEnsemblesFromRecovery.", exception);
}
});
return f;
}

Expand Down

0 comments on commit a6ecf36

Please sign in to comment.