[ 
https://issues.apache.org/jira/browse/SPARK-15391?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Davies Liu resolved SPARK-15391.
--------------------------------
       Resolution: Fixed
    Fix Version/s: 2.0.0

Issue resolved by pull request 13318
[https://github.com/apache/spark/pull/13318]

> Spark executor OOM during TimSort
> ---------------------------------
>
>                 Key: SPARK-15391
>                 URL: https://issues.apache.org/jira/browse/SPARK-15391
>             Project: Spark
>          Issue Type: Bug
>            Reporter: Sital Kedia
>            Assignee: Davies Liu
>             Fix For: 2.0.0
>
>
> While running a query, we are seeing a lot of executor OOM while doing 
> TimSort.
> Stack trace - 
> {code}
> at 
> org.apache.spark.util.collection.unsafe.sort.UnsafeSortDataFormat.allocate(UnsafeSortDataFormat.java:86)
>       at 
> org.apache.spark.util.collection.unsafe.sort.UnsafeSortDataFormat.allocate(UnsafeSortDataFormat.java:32)
>       at 
> org.apache.spark.util.collection.TimSort$SortState.ensureCapacity(TimSort.java:951)
>       at 
> org.apache.spark.util.collection.TimSort$SortState.mergeLo(TimSort.java:699)
>       at 
> org.apache.spark.util.collection.TimSort$SortState.mergeAt(TimSort.java:525)
>       at 
> org.apache.spark.util.collection.TimSort$SortState.mergeCollapse(TimSort.java:453)
>       at 
> org.apache.spark.util.collection.TimSort$SortState.access$200(TimSort.java:325)
>       at org.apache.spark.util.collection.TimSort.sort(TimSort.java:153)
>       at org.apache.spark.util.collection.Sorter.sort(Sorter.scala:37)
>       at 
> org.apache.spark.util.collection.unsafe.sort.UnsafeInMemorySorter.getSortedIterator(UnsafeInMemorySorter.java:235)
>       at 
> org.apache.spark.util.collection.unsafe.sort.UnsafeExternalSorter.spill(UnsafeExternalSorter.java:198)
>       at org.apache.spark.memory.MemoryConsumer.spill(MemoryConsumer.java:58)
>       at 
> org.apache.spark.util.collection.unsafe.sort.UnsafeExternalSorter.insertRecord(UnsafeExternalSorter.java:356)
>       at 
> org.apache.spark.sql.execution.UnsafeExternalRowSorter.insertRow(UnsafeExternalRowSorter.java:91)
> {code}
> Out of total 32g available to the executors, we are allocating 24g onheap and 
> 8g onheap memory. Looking at the code 
> (https://github.com/apache/spark/blob/master/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeSortDataFormat.java#L87),
>  we see that during TimSort we are allocating the memory buffer onheap 
> irrespective of memory mode that is reason of executor OOM. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to