You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by "AnonHxy (via GitHub)" <gi...@apache.org> on 2023/07/26 02:02:46 UTC

[GitHub] [bookkeeper] AnonHxy commented on a diff in pull request #4023: Fix headerBuffer leak in `DefaultEntryLogger.scanEntryLog`

AnonHxy commented on code in PR #4023:
URL: https://github.com/apache/bookkeeper/pull/4023#discussion_r1274289307


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java:
##########
@@ -968,12 +968,18 @@ public void scanEntryLog(long entryLogId, EntryLogScanner scanner) throws IOExce
         // Buffer where to read the entrySize (4 bytes) and the ledgerId (8 bytes)
         ByteBuf headerBuffer = Unpooled.buffer(4 + 8);
         BufferedReadChannel bc;
+        boolean throwExceptionWhenGetChannel = false;
         // Get the BufferedChannel for the current entry log file
         try {
             bc = getChannelForLogId(entryLogId);
         } catch (IOException e) {
             LOG.warn("Failed to get channel to scan entry log: " + entryLogId + ".log");
+            throwExceptionWhenGetChannel = true;

Review Comment:
   Why not call `headerBuffer.release()` here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org