colinmjj commented on a change in pull request #25759: [SPARK-19147][CORE] 
Gracefully handle error in task after executor is stopped
URL: https://github.com/apache/spark/pull/25759#discussion_r325961757
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/executor/Executor.scala
 ##########
 @@ -624,37 +624,43 @@ private[spark] class Executor(
           execBackend.statusUpdate(taskId, TaskState.KILLED, 
ser.serialize(reason))
 
         case t: Throwable =>
-          // Attempt to exit cleanly by informing the driver of our failure.
-          // If anything goes wrong (or this was a fatal exception), we will 
delegate to
-          // the default uncaught exception handler, which will terminate the 
Executor.
-          logError(s"Exception in $taskName (TID $taskId)", t)
-
-          // SPARK-20904: Do not report failure to driver if if happened 
during shut down. Because
-          // libraries may set up shutdown hooks that race with running tasks 
during shutdown,
-          // spurious failures may occur and can result in improper accounting 
in the driver (e.g.
-          // the task failure would not be ignored if the shutdown happened 
because of premption,
-          // instead of an app issue).
-          if (!ShutdownHookManager.inShutdown()) {
-            val (accums, accUpdates) = 
collectAccumulatorsAndResetStatusOnFailure(taskStartTimeNs)
-            val metricPeaks = 
WrappedArray.make(metricsPoller.getTaskMetricPeaks(taskId))
-
-            val serializedTaskEndReason = {
-              try {
-                val ef = new ExceptionFailure(t, accUpdates).withAccums(accums)
-                  .withMetricPeaks(metricPeaks)
-                ser.serialize(ef)
-              } catch {
-                case _: NotSerializableException =>
-                  // t is not serializable so just send the stacktrace
-                  val ef = new ExceptionFailure(t, accUpdates, 
false).withAccums(accums)
+          if (env.isStopped) {
 
 Review comment:
   Done

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to