jiangxb1987 commented on code in PR #48551:
URL: https://github.com/apache/spark/pull/48551#discussion_r1806898883
##########
core/src/test/scala/org/apache/spark/util/SparkUncaughtExceptionHandlerSuite.scala:
##########
@@ -74,6 +80,34 @@ object ThrowableTypes extends Enumeration {
val SparkFatalOutOfMemoryError =
ThrowableTypesVal("SparkFatalException(OutOfMemoryError)",
new SparkFatalException(new OutOfMemoryError))
+ // SPARK-50034: If there is a fatal error in the cause chain,
+ // we should also identify that fatal error and exit with the
+ // correct exit code.
+ val NestedOOMError = ThrowableTypesVal(
+ "DeepNestedFatalError",
+ new RuntimeException("Nonfatal Level 1",
+ new RuntimeException("Nonfatal Level 2",
+ new RuntimeException("Nonfatal Level 3",
+ new OutOfMemoryError())))
+ )
+
+ val NestedSparkFatalException = ThrowableTypesVal(
+ "DeepNestedMixedFatalErrors",
+ new RuntimeException("Nonfatal Level 1",
+ new RuntimeException("Nonfatal Level 2",
+ new SparkFatalException(new OutOfMemoryError())))
+ )
+
+ // Nested exception with non-fatal errors only
+ val NonFatalNestedErrors = ThrowableTypesVal(
Review Comment:
Should we also test the OOME under deeply nested exceptions, that exceeded
the killOnFatalErrorDepth?
##########
core/src/main/scala/org/apache/spark/util/SparkUncaughtExceptionHandler.scala:
##########
@@ -36,6 +38,20 @@ private[spark] class SparkUncaughtExceptionHandler(val
exitOnUncaughtException:
val _ = SparkExitCode.OOM
}
+ // The maximum depth to search in the exception cause chain for a fatal
error,
+ // as defined by killOnFatalErrorDepth in Executor.scala.
+ //
+ // SPARK-50034: When this handler is called, there is a fatal error in the
cause chain within
+ // the specified depth. We should identify that fatal error and exit with the
+ // correct exit code.
+ private val killOnFatalErrorDepth: Int = {
+ // At this point SparkEnv might be None
+ Option(SparkEnv.get) match {
Review Comment:
nit: Option(SparkEnv.get).map(...).getOrElse(5)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]