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/05/31 11:52:01 UTC
[iotdb] branch master updated: Remove unnecessary lock in runningToFinshed of DriverScheduler
This is an automated email from the ASF dual-hosted git repository.
jackietien 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 96ab3086434 Remove unnecessary lock in runningToFinshed of DriverScheduler
96ab3086434 is described below
commit 96ab30864342d1d0b98c5eaad9570d2a204d7784
Author: Liao Lanyu <14...@qq.com>
AuthorDate: Wed May 31 19:51:54 2023 +0800
Remove unnecessary lock in runningToFinshed of DriverScheduler
---
.../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 b043584c79a..d116a6fdcb6 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
@@ -543,13 +543,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