Skip to content

Commit

Permalink
Pipe: Fix the deadlock of PeriodicalJob thread caused by using parall…
Browse files Browse the repository at this point in the history
…elStream to split restartAllStuckPipes' subtasks (#14392)

Co-authored-by: Steve Yurong Su <[email protected]>
  • Loading branch information
luoluoyuyu and SteveYurongSu authored Dec 12, 2024
1 parent 9c65c32 commit 54197b9
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,13 @@ public void restartAllStuckPipes() {
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() {
Expand Down

0 comments on commit 54197b9

Please sign in to comment.