spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Imran Rashid <>
Subject Re: Catching executor exception from executor in driver
Date Tue, 14 Apr 2015 21:59:51 GMT

Hi Justin,

short answer: no, there is no way to do that.

I'm just guessing here, but I imagine this was done to eliminate
serialization problems (eg., what if we got an error trying to serialize
the user exception to send from the executors back to the driver?).
Though, actually that isn't a great explanation either, since even when the
info gets back to the driver, its broken into a few string fields (eg., we
have the class name of the root exception), but eventually it just gets
converted to one big string.

I've cc'ed dev b/c I think this is an oversight in Spark.  It makes it
really hard to write an app to deal gracefully with various exceptions --
all you can do is look at the string in SparkException (which could change
arbitrarily between versions, in addition to just being a pain to work
with).  We should probably add much more fine-grained subclasses of
SparkException, at the very least distinguishing errors in user code vs.
errors in spark.  I could imagine there might be a few other cases we'd
like to distinguish more carefully as well.

Any thoughts from other devs?


On Tue, Apr 14, 2015 at 4:46 PM, Justin Yip <> wrote:

> Hello,
> I would like to know if there is a way of catching exception throw from
> executor exception from the driver program. Here is an example:
> try {
>   val x = sc.parallelize(Seq(1,2,3)).map(e => e / 0).collect
> } catch {
>   case e: SparkException => {
>     println(s"ERROR: $e")
>     println(s"CAUSE: ${e.getCause}")
>   }
> }
> Output:
> ERROR: org.apache.spark.SparkException: Job aborted due to stage failure:
> Task 1 in stage 1.0 failed 4 times, most recent failure: Lost task 1.3 in
> stage 1.0 (TID 15, pio1.c.ace-lotus-714.internal):
> java.lang.ArithmeticException: / by zero
> at
> $line71.$read$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$anonfun$1.apply$mcII$sp(<console>:51)
> ...
> CAUSE: null
> The exception cause is a null value. Is there any way that I can catch the
> ArithmeticException?
> Thanks
> Justin
> ------------------------------
> View this message in context: Catching executor exception from executor
> in driver
> <>
> Sent from the Apache Spark User List mailing list archive
> <> at

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message