You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by da...@apache.org on 2016/03/18 20:56:08 UTC
spark git commit: [SPARK-13958] Executor OOM due to unbounded growth of pointer array in…
Repository: spark
Updated Branches:
refs/heads/master 353778216 -> 2e0c5284f
[SPARK-13958] Executor OOM due to unbounded growth of pointer array in…
## What changes were proposed in this pull request?
This change fixes the executor OOM which was recently introduced in PR apache/spark#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 <sk...@fb.com>
Closes #11794 from sitalkedia/SPARK-13958.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/2e0c5284
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/2e0c5284
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/2e0c5284
Branch: refs/heads/master
Commit: 2e0c5284fd88ba89f53f93dcf1eb26bca2be49c5
Parents: 3537782
Author: Sital Kedia <sk...@fb.com>
Authored: Fri Mar 18 12:56:06 2016 -0700
Committer: Davies Liu <da...@gmail.com>
Committed: Fri Mar 18 12:56:06 2016 -0700
----------------------------------------------------------------------
.../spark/shuffle/sort/ShuffleExternalSorter.java | 13 ++++++++++++-
.../collection/unsafe/sort/UnsafeExternalSorter.java | 13 ++++++++++++-
2 files changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/2e0c5284/core/src/main/java/org/apache/spark/shuffle/sort/ShuffleExternalSorter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/spark/shuffle/sort/ShuffleExternalSorter.java b/core/src/main/java/org/apache/spark/shuffle/sort/ShuffleExternalSorter.java
index 7a114df..c7d89e6 100644
--- a/core/src/main/java/org/apache/spark/shuffle/sort/ShuffleExternalSorter.java
+++ b/core/src/main/java/org/apache/spark/shuffle/sort/ShuffleExternalSorter.java
@@ -320,7 +320,18 @@ final class ShuffleExternalSorter extends MemoryConsumer {
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);
http://git-wip-us.apache.org/repos/asf/spark/blob/2e0c5284/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java b/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
index 9236bd2..db8e7a7 100644
--- a/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
+++ b/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
@@ -293,7 +293,18 @@ public final class UnsafeExternalSorter extends MemoryConsumer {
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);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org