[
https://issues.apache.org/jira/browse/SPARK-32901?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Herman van Hövell resolved SPARK-32901.
---------------------------------------
Fix Version/s: 3.1.0
3.0.2
Assignee: Tom van Bussel
Resolution: Fixed
> UnsafeExternalSorter may cause a SparkOutOfMemoryError to be thrown while
> spilling
> ----------------------------------------------------------------------------------
>
> Key: SPARK-32901
> URL: https://issues.apache.org/jira/browse/SPARK-32901
> Project: Spark
> Issue Type: Bug
> Components: Spark Core
> Affects Versions: 2.4.7, 3.0.1
> Reporter: Tom van Bussel
> Assignee: Tom van Bussel
> Priority: Major
> Fix For: 3.0.2, 3.1.0
>
>
> Consider the following sequence of events:
> # {{UnsafeExternalSorter}} runs out of space in its pointer array and
> attempts to allocate a large array to replace the current one.
> # {{TaskMemoryManager}} tries to allocate the memory backing the large array
> using {{MemoryManager}}, but {{MemoryManager}} is only willing to return most
> but not all of the memory requested.
> # {{TaskMemoryManager}} asks {{UnsafeExternalSorter}} to spill, which causes
> {{UnsafeExternalSorter}} to spill the current run to disk, to free its record
> pages and to reset its {{UnsafeInMemorySorter}}.
> # {{UnsafeInMemorySorter}} frees its pointer array, and tries to allocate a
> new small pointer array.
> # {{TaskMemoryManager}} tries to allocate the memory backing the small array
> using {{MemoryManager}}, but {{MemoryManager}} is unwilling to give it any
> memory, as the {{TaskMemoryManager}} is still holding on to the memory it got
> for the large array.
> # {{TaskMemoryManager}} again asks {{UnsafeExternalSorter}} to spill, but
> this time there is nothing to spill.
> # {{UnsafeInMemorySorter}} receives less memory than it requested, and
> causes a {{SparkOutOfMemoryError}} to be thrown, which causes the current
> task to fail.
> A simple way to fix this is to avoid allocating a new array in
> {{UnsafeInMemorySorter.reset()}} and to do this on-demand instead.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]