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 2023/04/28 01:40:52 UTC

[iotdb] branch ResultHandleNPE1.1 created (now 8303d816cf)

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

jackietien pushed a change to branch ResultHandleNPE1.1
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at 8303d816cf [To rel/1.1] Forbid the query executor thread interrupted by other threads

This branch includes the following new commits:

     new 8303d816cf [To rel/1.1] Forbid the query executor thread interrupted by other threads

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: [To rel/1.1] Forbid the query executor thread interrupted by other threads

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 8303d816cfbfe9513e3713657d07bfc64b879319
Author: Jackie Tien <ja...@gmail.com>
AuthorDate: Fri Apr 28 09:10:31 2023 +0800

    [To rel/1.1] Forbid the query executor thread interrupted by other threads
---
 .../java/org/apache/iotdb/db/mpp/execution/driver/Driver.java    | 2 +-
 .../iotdb/db/mpp/execution/schedule/AbstractDriverThread.java    | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/driver/Driver.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/driver/Driver.java
index c3be5e1bbf..f92650bcde 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/driver/Driver.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/driver/Driver.java
@@ -125,7 +125,7 @@ public abstract class Driver implements IDriver {
         tryWithLock(
             100,
             TimeUnit.MILLISECONDS,
-            true,
+            false,
             () -> {
               // only keep doing query processing if driver state is still alive
               if (state.get() == State.ALIVE) {
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/AbstractDriverThread.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/AbstractDriverThread.java
index 72f5ce64a8..04db5adcb5 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/AbstractDriverThread.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/AbstractDriverThread.java
@@ -80,6 +80,15 @@ public abstract class AbstractDriverThread extends Thread implements Closeable {
             next.setAbortCause(DriverTaskAbortedException.BY_INTERNAL_ERROR_SCHEDULED);
             scheduler.toAborted(next);
           }
+        } finally {
+          // Clear the interrupted flag on the current thread, driver cancellation may have
+          // triggered an interrupt
+          if (Thread.interrupted()) {
+            if (closed) {
+              // reset interrupted flag if closed before interrupt
+              Thread.currentThread().interrupt();
+            }
+          }
         }
       }
     } finally {