Skip to content

Commit

Permalink
[IOTDB-2381] Fix deadlock caused by incorrect buffer pool size counter (
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpai committed Jan 14, 2022
1 parent 3660af8 commit 3bec897
Showing 1 changed file with 2 additions and 3 deletions.
Expand Up @@ -302,17 +302,16 @@ public ByteBuffer[] getWalDirectByteBuffer() {
// 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;
}
Expand Down

0 comments on commit 3bec897

Please sign in to comment.