Skip to content

Commit

Permalink
[SPARK-13958] Executor OOM due to unbounded growth of pointer array in…
Browse files Browse the repository at this point in the history
## What changes were proposed in this pull request?

This change fixes the executor OOM which was recently introduced in PR #11095
(Please fill in changes proposed in this fix)

## How was this patch tested?
Tested by running a spark job on the cluster.
(Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)

(If this patch involves UI changes, please attach a screenshot; otherwise, remove this)

… Sorter

Author: Sital Kedia <skedia@fb.com>

Closes #11794 from sitalkedia/SPARK-13958.

(cherry picked from commit 2e0c528)
Signed-off-by: Davies Liu <davies.liu@gmail.com>
  • Loading branch information
Sital Kedia authored and davies committed Mar 18, 2016
1 parent 1fcd17f commit 022e06d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,18 @@ private void growPointerArrayIfNecessary() throws IOException {
assert(inMemSorter != null);
if (!inMemSorter.hasSpaceForAnotherRecord()) {
long used = inMemSorter.getMemoryUsage();
LongArray array = allocateArray(used / 8 * 2);
LongArray array;
try {
// could trigger spilling
array = allocateArray(used / 8 * 2);
} catch (OutOfMemoryError e) {
// should have trigger spilling
if (!inMemSorter.hasSpaceForAnotherRecord()) {
logger.error("Unable to grow the pointer array");
throw e;
}
return;
}
// check if spilling is triggered or not
if (inMemSorter.hasSpaceForAnotherRecord()) {
freeArray(array);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,18 @@ private void growPointerArrayIfNecessary() throws IOException {
assert(inMemSorter != null);
if (!inMemSorter.hasSpaceForAnotherRecord()) {
long used = inMemSorter.getMemoryUsage();
LongArray array = allocateArray(used / 8 * 2);
LongArray array;
try {
// could trigger spilling
array = allocateArray(used / 8 * 2);
} catch (OutOfMemoryError e) {
// should have trigger spilling
if (!inMemSorter.hasSpaceForAnotherRecord()) {
logger.error("Unable to grow the pointer array");
throw e;
}
return;
}
// check if spilling is triggered or not
if (inMemSorter.hasSpaceForAnotherRecord()) {
freeArray(array);
Expand Down

0 comments on commit 022e06d

Please sign in to comment.