Skip to content

Commit 54197b9

Browse files
Pipe: Fix the deadlock of PeriodicalJob thread caused by using parallelStream to split restartAllStuckPipes' subtasks (apache#14392)
Co-authored-by: Steve Yurong Su <[email protected]>
1 parent 9c65c32 commit 54197b9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,13 @@ public void restartAllStuckPipes() {
484484
releaseWriteLock();
485485
}
486486

487-
// Restart all stuck pipes
488-
stuckPipes.parallelStream().forEach(this::restartStuckPipe);
487+
// Restart all stuck pipes.
488+
// Note that parallelStream cannot be used here. The method PipeTaskAgent#dropPipe also uses
489+
// parallelStream. If parallelStream is used here, the subtasks generated inside the dropPipe
490+
// may not be scheduled by the worker thread of ForkJoinPool because of less available threads,
491+
// and the parent task will wait for the completion of the subtasks in ForkJoinPool forever,
492+
// causing the deadlock.
493+
stuckPipes.forEach(this::restartStuckPipe);
489494
}
490495

491496
private Set<PipeMeta> findAllStuckPipes() {

0 commit comments

Comments
 (0)