Skip to content

Commit

Permalink
SuperSorter: Don't set allDone if it's already set. (apache#17238)
Browse files Browse the repository at this point in the history
This fixes a race where, if there is no output at all, setAllDoneIfPossible
could be called twice (once when the output partitions future resolves, and
once when the batcher finishes). If the calls happen in that order, it would
try to create nil output channels both times, resulting in a "Channel already set"
error.
  • Loading branch information
gianm authored Oct 4, 2024
1 parent acd9732 commit b9634a8
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,11 @@ private void runWorkersIfPossible()
@GuardedBy("runWorkersLock")
private void setAllDoneIfPossible()
{
if (isAllDone()) {
// Already done, no need to set allDone again.
return;
}

try {
if (totalInputFrames == 0 && outputPartitionsFuture.isDone()) {
// No input data -- generate empty output channels.
Expand Down

0 comments on commit b9634a8

Please sign in to comment.