Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CELEBORN-1544] ShuffleWriter needs to call close finally to avoid memory leaks #2661

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,14 @@ public void write(scala.collection.Iterator<Product2<K, V>> records) throws IOEx
} else {
write0(records);
}
close();
} catch (InterruptedException e) {
TaskInterruptedHelper.throwTaskKillException();
} finally {
try {
close();
} catch (InterruptedException e) {
TaskInterruptedHelper.throwTaskKillException();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,21 @@ public SortBasedShuffleWriter(

@Override
public void write(scala.collection.Iterator<Product2<K, V>> records) throws IOException {
if (canUseFastWrite()) {
fastWrite0(records);
} else if (dep.mapSideCombine()) {
if (dep.aggregator().isEmpty()) {
throw new UnsupportedOperationException(
"When using map side combine, an aggregator must be specified.");
try {
if (canUseFastWrite()) {
fastWrite0(records);
} else if (dep.mapSideCombine()) {
if (dep.aggregator().isEmpty()) {
throw new UnsupportedOperationException(
"When using map side combine, an aggregator must be specified.");
}
write0(dep.aggregator().get().combineValuesByKey(records, taskContext));
} else {
write0(records);
}
write0(dep.aggregator().get().combineValuesByKey(records, taskContext));
} else {
write0(records);
} finally {
close();
}
close();
}

@VisibleForTesting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,14 @@ public void write(scala.collection.Iterator<Product2<K, V>> records) throws IOEx
} else {
write0(records);
}
close();
} catch (InterruptedException e) {
TaskInterruptedHelper.throwTaskKillException();
} finally {
try {
close();
} catch (InterruptedException e) {
TaskInterruptedHelper.throwTaskKillException();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,11 @@ void doWrite(scala.collection.Iterator<Product2<K, V>> records) throws IOExcepti

@Override
public void write(scala.collection.Iterator<Product2<K, V>> records) throws IOException {
doWrite(records);
close();
try {
doWrite(records);
} finally {
close();
}
}

@VisibleForTesting
Expand Down
Loading