GitHub user eyalfa opened a pull request:
https://github.com/apache/spark/pull/19181
[SPARK-21907][CORE] oom during spill
## What changes were proposed in this pull request?
1. a test reproducing
[SPARK-21907](https://issues.apache.org/jira/browse/SPARK-21907)
2. a fix for the root cause of the issue.
`org.apache.spark.util.collection.unsafe.sort.UnsafeExternalSorter.spill`
calls `org.apache.spark.util.collection.unsafe.sort.UnsafeInMemorySorter.reset`
which may trigger another spill,
when this happens the `array` member is already de-allocated but still
referenced by the code, this causes the nested spill to fail with an NPE in
`org.apache.spark.memory.TaskMemoryManager.getPage`.
This patch introduces a reproduction in a test case and a fix, the fix
simply sets the in-mem sorter's array member to an empty array before actually
performing the allocation. This prevents the spilling code from 'touching' the
de-allocated array.
## How was this patch tested?
introduced a new test case:
`org.apache.spark.util.collection.unsafe.sort.UnsafeExternalSorterSuite#testOOMDuringSpill`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/eyalfa/spark SPARK-21907__oom_during_spill
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/19181.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #19181
----
commit c9cbe1a3e3e794e9c1ee54d498301c3f332c3f6c
Author: Eyal Farago <[email protected]>
Date: 2017-09-10T10:05:06Z
SPARK-21907__oom_during_spill: introduce a reproducing test.
commit cc8ccfd3f3956a7652ec82e9748ec56609b19800
Author: Eyal Farago <[email protected]>
Date: 2017-09-10T14:29:32Z
SPARK-21907__oom_during_spill: fix the root cause of this bug, improve test
by requiring OOM exception thrown from the reset() method.
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]