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

tanxinyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new a2f02048ec2 DAL: Fix thread leak when DN exit. #15395
a2f02048ec2 is described below

commit a2f02048ec2f19c040583f6b71401e2d8eef475c
Author: Peng Junzhi <[email protected]>
AuthorDate: Sun Apr 27 16:43:21 2025 +0800

    DAL: Fix thread leak when DN exit. #15395
---
 .../consensus/deletion/persist/PageCacheDeletionBuffer.java   | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/deletion/persist/PageCacheDeletionBuffer.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/deletion/persist/PageCacheDeletionBuffer.java
index 0bde64fd371..7cb1600c6a5 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/deletion/persist/PageCacheDeletionBuffer.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/deletion/persist/PageCacheDeletionBuffer.java
@@ -261,7 +261,15 @@ public class PageCacheDeletionBuffer implements 
DeletionBuffer {
     // first waiting serialize and sync tasks finished, then release all 
resources
     waitUntilFlushAllDeletionsOrTimeOut();
     if (persistThread != null) {
-      persistThread.shutdown();
+      persistThread.shutdownNow();
+      try {
+        if (!persistThread.awaitTermination(30, TimeUnit.SECONDS)) {
+          LOGGER.warn("persistThread did not terminate within {}s", 30);
+        }
+      } catch (InterruptedException e) {
+        LOGGER.warn("DAL Thread {} still doesn't exit after 30s", 
dataRegionId);
+        Thread.currentThread().interrupt();
+      }
     }
     // clean buffer
     MmapUtil.clean(serializeBuffer);
@@ -330,6 +338,7 @@ public class PageCacheDeletionBuffer implements 
DeletionBuffer {
         LOGGER.warn(
             "Interrupted when waiting for taking DeletionResource from 
blocking queue to serialize.");
         Thread.currentThread().interrupt();
+        return;
       }
 
       // For further deletion, we use non-blocking poll() method to persist 
existing deletion of

Reply via email to