forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from markhamstra/master-csd
SPY-302 backporting of SPARK-1620, SPARK-1685, SPARK-1686, SPARK-1772
- Loading branch information
Showing
12 changed files
with
163 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
core/src/main/scala/org/apache/spark/executor/ExecutorUncaughtExceptionHandler.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.spark.executor | ||
|
||
import org.apache.spark.Logging | ||
import org.apache.spark.util.Utils | ||
|
||
/** | ||
* The default uncaught exception handler for Executors terminates the whole process, to avoid | ||
* getting into a bad state indefinitely. Since Executors are relatively lightweight, it's better | ||
* to fail fast when things go wrong. | ||
*/ | ||
private[spark] object ExecutorUncaughtExceptionHandler | ||
extends Thread.UncaughtExceptionHandler with Logging { | ||
|
||
override def uncaughtException(thread: Thread, exception: Throwable) { | ||
try { | ||
logError("Uncaught exception in thread " + thread, exception) | ||
|
||
// We may have been called from a shutdown hook. If so, we must not call System.exit(). | ||
// (If we do, we will deadlock.) | ||
if (!Utils.inShutdown()) { | ||
if (exception.isInstanceOf[OutOfMemoryError]) { | ||
System.exit(ExecutorExitCode.OOM) | ||
} else { | ||
System.exit(ExecutorExitCode.UNCAUGHT_EXCEPTION) | ||
} | ||
} | ||
} catch { | ||
case oom: OutOfMemoryError => Runtime.getRuntime.halt(ExecutorExitCode.OOM) | ||
case t: Throwable => Runtime.getRuntime.halt(ExecutorExitCode.UNCAUGHT_EXCEPTION_TWICE) | ||
} | ||
} | ||
|
||
def uncaughtException(exception: Throwable) { | ||
uncaughtException(Thread.currentThread(), exception) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.