You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2022/01/14 00:59:06 UTC

[iotdb] branch rel/0.12 updated: [IOTDB-2381] Fix deadlock caused by incorrect buffer pool size counter (#4797) (#4807)

This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch rel/0.12
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/0.12 by this push:
     new 3bec897  [IOTDB-2381] Fix deadlock caused by incorrect buffer pool size counter (#4797) (#4807)
3bec897 is described below

commit 3bec89746619b01bcd4b66d5fe2f2861e5c83593
Author: BaiJian <er...@hotmail.com>
AuthorDate: Fri Jan 14 08:58:22 2022 +0800

    [IOTDB-2381] Fix deadlock caused by incorrect buffer pool size counter (#4797) (#4807)
---
 .../apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java   | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
index e44ce60..53eca34 100755
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
@@ -302,17 +302,16 @@ public class StorageGroupProcessor {
         // if the queue is empty and current size is less than MAX_BYTEBUFFER_NUM
         // we can construct another two more new byte buffer
         try {
-          currentWalPoolSize += 2;
           res[0] = ByteBuffer.allocateDirect(WAL_BUFFER_SIZE);
           res[1] = ByteBuffer.allocateDirect(WAL_BUFFER_SIZE);
+          currentWalPoolSize += 2;
         } catch (OutOfMemoryError e) {
+          logger.error("Allocate ByteBuffers error", e);
           if (res[0] != null) {
             MmapUtil.clean((MappedByteBuffer) res[0]);
-            currentWalPoolSize -= 1;
           }
           if (res[1] != null) {
             MmapUtil.clean((MappedByteBuffer) res[1]);
-            currentWalPoolSize -= 1;
           }
           return null;
         }