You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2021/10/10 08:53:37 UTC

[GitHub] [bookkeeper] Shoothzj opened a new pull request #2819: Forget to close preAllocator log on shutdown

Shoothzj opened a new pull request #2819:
URL: https://github.com/apache/bookkeeper/pull/2819


   ### Motivation
   Release the filehandler which preAllocator acquired.
   It will cause a file handler leak on shutdown. Typically useful on windows unit test
   ### Changes
   If preAllocator success, close the bufferchannel on stop.


-- 
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: issues-unsubscribe@bookkeeper.apache.org

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



[GitHub] [bookkeeper] merlimat merged pull request #2819: Forget to close preAllocator log on shutdown

Posted by GitBox <gi...@apache.org>.
merlimat merged pull request #2819:
URL: https://github.com/apache/bookkeeper/pull/2819


   


-- 
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: issues-unsubscribe@bookkeeper.apache.org

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



[GitHub] [bookkeeper] eolivelli commented on a change in pull request #2819: Forget to close preAllocator log on shutdown

Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #2819:
URL: https://github.com/apache/bookkeeper/pull/2819#discussion_r725622876



##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java
##########
@@ -182,6 +183,21 @@ private synchronized BufferedLogChannel allocateNewLog(File dirForNextEntryLog,
         return logChannel;
     }
 
+
+    private synchronized void closePreAllocateLog() {
+        if (preallocatedLogId != -1) {
+            // if preallocate new log success, release the file channel
+            try {
+                BufferedLogChannel bufferedLogChannel = getPreallocationFuture().get(3, TimeUnit.SECONDS);
+                if (bufferedLogChannel != null) {
+                    bufferedLogChannel.close();
+                }
+            } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
+                log.warn("release preAllocator log failed, ignore error");

Review comment:
       Please hande InterruptedException and set Thread.currentThread.interrupt()




-- 
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: issues-unsubscribe@bookkeeper.apache.org

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



[GitHub] [bookkeeper] Shoothzj closed pull request #2819: Forget to close preAllocator log on shutdown

Posted by GitBox <gi...@apache.org>.
Shoothzj closed pull request #2819:
URL: https://github.com/apache/bookkeeper/pull/2819


   


-- 
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: issues-unsubscribe@bookkeeper.apache.org

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



[GitHub] [bookkeeper] Shoothzj commented on pull request #2819: Forget to close preAllocator log on shutdown

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #2819:
URL: https://github.com/apache/bookkeeper/pull/2819#issuecomment-947482253


   @merlimat PTAL


-- 
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: issues-unsubscribe@bookkeeper.apache.org

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



[GitHub] [bookkeeper] Shoothzj commented on a change in pull request #2819: Forget to close preAllocator log on shutdown

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on a change in pull request #2819:
URL: https://github.com/apache/bookkeeper/pull/2819#discussion_r725736315



##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java
##########
@@ -182,6 +183,21 @@ private synchronized BufferedLogChannel allocateNewLog(File dirForNextEntryLog,
         return logChannel;
     }
 
+
+    private synchronized void closePreAllocateLog() {
+        if (preallocatedLogId != -1) {
+            // if preallocate new log success, release the file channel
+            try {
+                BufferedLogChannel bufferedLogChannel = getPreallocationFuture().get(3, TimeUnit.SECONDS);
+                if (bufferedLogChannel != null) {
+                    bufferedLogChannel.close();
+                }
+            } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
+                log.warn("release preAllocator log failed, ignore error");

Review comment:
       Resolved




-- 
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: issues-unsubscribe@bookkeeper.apache.org

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