You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/02/18 07:30:22 UTC

[GitHub] [iotdb] ericpai commented on a change in pull request #5085: [IOTDB-2567] Fix thread and ByteBuffer leak after service stopped

ericpai commented on a change in pull request #5085:
URL: https://github.com/apache/iotdb/pull/5085#discussion_r809736633



##########
File path: server/src/main/java/org/apache/iotdb/db/writelog/node/ExclusiveWriteLogNode.java
##########
@@ -171,6 +178,26 @@ public void close() {
     }
   }
 
+  @Override
+  public void release() {
+    ThreadUtils.stopThreadPool(FLUSH_BUFFER_THREAD_POOL, WAL_FLUSH);
+    lock.lock();
+    try {
+      if (this.logBufferWorking != null && this.logBufferWorking instanceof MappedByteBuffer) {
+        MmapUtil.clean((MappedByteBuffer) this.logBufferFlushing);
+      }
+      if (this.logBufferIdle != null && this.logBufferIdle instanceof MappedByteBuffer) {
+        MmapUtil.clean((MappedByteBuffer) this.logBufferIdle);
+      }
+      if (this.logBufferFlushing != null && this.logBufferFlushing instanceof MappedByteBuffer) {
+        MmapUtil.clean((MappedByteBuffer) this.logBufferFlushing);
+      }

Review comment:
       The `walByteBufferPool` only manages 'idle' ByteBuffers. But there're other buffers allocated by `ExclusiveWriteLogNode` and removed from `walByteBufferPool` in https://github.com/ericpai/iotdb/blob/master/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/VirtualStorageGroupProcessor.java#L306-L307.
   In the `ExclusiveWriteLogNode`, there's no opportunity to push back the buffers to the pool.
   This conclusion can be proved by the OutOfMemory error described in JIRA.




-- 
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: reviews-unsubscribe@iotdb.apache.org

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