This is an automated email from the ASF dual-hosted git repository.
rong 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 54197b95d28 Pipe: Fix the deadlock of PeriodicalJob thread caused by
using parallelStream to split restartAllStuckPipes' subtasks (#14392)
54197b95d28 is described below
commit 54197b95d28026ffe4365addbd5c737d67e30942
Author: Zhenyu Luo <[email protected]>
AuthorDate: Thu Dec 12 16:36:38 2024 +0800
Pipe: Fix the deadlock of PeriodicalJob thread caused by using
parallelStream to split restartAllStuckPipes' subtasks (#14392)
Co-authored-by: Steve Yurong Su <[email protected]>
---
.../apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java
index 11288549123..144dfd1ed70 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java
@@ -484,8 +484,13 @@ public class PipeDataNodeTaskAgent extends PipeTaskAgent {
releaseWriteLock();
}
- // Restart all stuck pipes
- stuckPipes.parallelStream().forEach(this::restartStuckPipe);
+ // Restart all stuck pipes.
+ // Note that parallelStream cannot be used here. The method
PipeTaskAgent#dropPipe also uses
+ // parallelStream. If parallelStream is used here, the subtasks generated
inside the dropPipe
+ // may not be scheduled by the worker thread of ForkJoinPool because of
less available threads,
+ // and the parent task will wait for the completion of the subtasks in
ForkJoinPool forever,
+ // causing the deadlock.
+ stuckPipes.forEach(this::restartStuckPipe);
}
private Set<PipeMeta> findAllStuckPipes() {