Skip to content

Commit

Permalink
Release OpAddEntry.data when entry is copied and discarded (apache#10773
Browse files Browse the repository at this point in the history
)

Fixes apache#10738

### Motivation

There's a ByteBuf leak that happens in ledger rollover. The repro case in apache#10738 reproduces some Netty ByteBuf leaks that are detected by the Netty Leak detector.

### Modifications

Release `OpAddEntry.data` when the original entry is copied and discarded

### Additional Context

This PR was split out of PR apache#10755 which was closed without merging.
  • Loading branch information
lhotari authored and yangl committed Jun 23, 2021
1 parent cf5c1a3 commit fe47606
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,8 @@ public synchronized void updateLedgersIdsComplete(Stat stat) {
if (existsOp.ledger != null) {
existsOp.close();
existsOp = OpAddEntry.create(existsOp.ml, existsOp.data, existsOp.getNumberOfMessages(), existsOp.callback, existsOp.ctx);
// release the extra retain
ReferenceCountUtil.release(existsOp.data);
}
existsOp.setLedger(currentLedger);
if (beforeAddEntry(existsOp)) {
Expand Down

0 comments on commit fe47606

Please sign in to comment.