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

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


The following commit(s) were added to refs/heads/rel/1.1 by this push:
     new 6ac6e0792a6 [To rel/1.1] Release resource of FI after all drivers have 
been closed
6ac6e0792a6 is described below

commit 6ac6e0792a65cdd6d2637a09a1b785cb94a2d157
Author: Liao Lanyu <[email protected]>
AuthorDate: Wed May 31 19:54:19 2023 +0800

    [To rel/1.1] Release resource of FI after all drivers have been closed
---
 .../iotdb/db/mpp/execution/schedule/DriverScheduler.java     | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/DriverScheduler.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/DriverScheduler.java
index c581f677091..2e0836c638c 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/DriverScheduler.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/DriverScheduler.java
@@ -488,13 +488,11 @@ public class DriverScheduler implements IDriverScheduler, 
IService {
       } finally {
         task.unlock();
       }
-      // wrap this clearDriverTask to avoid that status is changed to Aborted 
during clearDriverTask
-      task.lock();
-      try {
-        clearDriverTask(task);
-      } finally {
-        task.unlock();
-      }
+      // Wrapping clearDriverTask with task.lock() may lead to deadlock. For 
example:
+      // Thread A locks a task and then try to remove it from a 
SynchronizedSet(instance related
+      // tasks) which will try to get the lock of SynchronizedSet.
+      // Thread B locks the SynchronizedSet first and then tries to lock the 
task.
+      clearDriverTask(task);
     }
 
     @Override

Reply via email to