Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IOTDB-2381] Fix deadlock caused by incorrect buffer pool size counter #4797

Merged
merged 1 commit into from Jan 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -311,17 +311,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