Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private[yarn] class ExecutorRunnable(
// For log4j configuration to reference
javaOpts += ("-Dspark.yarn.app.container.log.dir=" + ApplicationConstants.LOG_DIR_EXPANSION_VAR)

YarnSparkHadoopUtil.addOutOfMemoryErrorArgument(javaOpts)
YarnSparkHadoopUtil.addOutOfMemoryErrorArgument(javaOpts, sparkConf)
val commands = prefixEnv ++
Seq(Environment.JAVA_HOME.$$() + "/bin/java", "-server") ++
javaOpts ++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,17 @@ object YarnSparkHadoopUtil {
* the behavior of '%' in a .cmd file: it gets interpreted as an incomplete environment
* variable. Windows .cmd files escape a '%' by '%%'. Thus, the correct way of writing
* '%%p' in an escaped way is '%%%%p'.
*
* Optional handling of OutOfMemoryError (OOM) for executor JVMs.
*/
private[yarn] def addOutOfMemoryErrorArgument(javaOpts: ListBuffer[String]): Unit = {
private[yarn] def addOutOfMemoryErrorArgument(
javaOpts: ListBuffer[String],
conf: SparkConf): Unit = {

if (!conf.getBoolean("spark.executor.killOnOutOfMemoryError", false)) {
return
}

if (!javaOpts.exists(_.contains("-XX:OnOutOfMemoryError"))) {
if (Utils.isWindows) {
javaOpts += escapeForShell("-XX:OnOutOfMemoryError=taskkill /F /PID %%%%p")
Expand Down