Skip to content

Commit 5aa3f1a

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

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
@@ -486,8 +486,13 @@ public void restartAllStuckPipes() {
486486
releaseWriteLock();
487487
}
488488

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

493498
private Set<PipeMeta> findAllStuckPipes() {

0 commit comments

Comments
 (0)