Repository: spark
Updated Branches:
  refs/heads/branch-2.1 7015f6f0e -> 7fc2347b5


[SPARK-20250][CORE] Improper OOM error when a task been killed while spilling 
data

Currently, when a task is calling spill() but it receives a killing request 
from driver (e.g., speculative task), the `TaskMemoryManager` will throw an 
`OOM` exception.  And we don't catch `Fatal` exception when a error caused by 
`Thread.interrupt`. So for `ClosedByInterruptException`, we should throw 
`RuntimeException` instead of `OutOfMemoryError`.

https://issues.apache.org/jira/browse/SPARK-20250?jql=project%20%3D%20SPARK

Existing unit tests.

Author: Xianyang Liu <[email protected]>

Closes #18090 from ConeyLiu/SPARK-20250.

(cherry picked from commit 731462a04f8e33ac507ad19b4270c783a012a33e)
Signed-off-by: Wenchen Fan <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/7fc2347b
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/7fc2347b
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/7fc2347b

Branch: refs/heads/branch-2.1
Commit: 7fc2347b510d73fb55ab69c0579494b0761fb022
Parents: 7015f6f
Author: Xianyang Liu <[email protected]>
Authored: Thu May 25 15:47:59 2017 +0800
Committer: Wenchen Fan <[email protected]>
Committed: Thu May 25 15:51:27 2017 +0800

----------------------------------------------------------------------
 .../java/org/apache/spark/memory/TaskMemoryManager.java     | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/7fc2347b/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java 
b/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java
index c40974b..3385d0e 100644
--- a/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java
+++ b/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java
@@ -19,6 +19,7 @@ package org.apache.spark.memory;
 
 import javax.annotation.concurrent.GuardedBy;
 import java.io.IOException;
+import java.nio.channels.ClosedByInterruptException;
 import java.util.Arrays;
 import java.util.BitSet;
 import java.util.HashSet;
@@ -156,6 +157,10 @@ public class TaskMemoryManager {
                   break;
                 }
               }
+            } catch (ClosedByInterruptException e) {
+              // This called by user to kill a task (e.g: speculative task).
+              logger.error("error while calling spill() on " + c, e);
+              throw new RuntimeException(e.getMessage());
             } catch (IOException e) {
               logger.error("error while calling spill() on " + c, e);
               throw new OutOfMemoryError("error while calling spill() on " + c 
+ " : "
@@ -174,6 +179,10 @@ public class TaskMemoryManager {
               Utils.bytesToString(released), consumer);
             got += memoryManager.acquireExecutionMemory(required - got, 
taskAttemptId, mode);
           }
+        } catch (ClosedByInterruptException e) {
+          // This called by user to kill a task (e.g: speculative task).
+          logger.error("error while calling spill() on " + consumer, e);
+          throw new RuntimeException(e.getMessage());
         } catch (IOException e) {
           logger.error("error while calling spill() on " + consumer, e);
           throw new OutOfMemoryError("error while calling spill() on " + 
consumer + " : "


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to