Skip to content

[SPARK-2403] Catch all errors during serialization in DAGScheduler #1329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
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 @@ -768,6 +768,10 @@ class DAGScheduler(
abortStage(stage, "Task not serializable: " + e.toString)
runningStages -= stage
return
case e: Throwable => // Other exceptions, such as IllegalArgumentException from Kryo.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please catch NonFatal(e) instead. I think we should catch StackOverflowError here (as that is a possible error during serialization), but we should not catch OOMs and other such throwables except to re-throw them.

NB: Despite what the documentation says, NonFatal does indeed seem to catch StackOverflowError:

scala> NonFatal(new StackOverflowError())
res1: Boolean = true

scala> NonFatal(new OutOfMemoryError())
res2: Boolean = false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect you are testing this on 2.10. Looks like a change in 2.11:

scala/scala@6460365#diff-ff42321ce198f97308744271b7e17c76

I think their argument applies to Spark too. Sounds like it is not safe to try and recover from StackOverflowError.

Thanks for the comments! I'll update the pull request in a moment.

abortStage(stage, "Task serialization failed: " + e.toString)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the prior case, of NotSerializableException, the error message was likely sufficient. However, since we're dealing with arbitrary exceptions here, the user may need to actually see the full stack trace to understand what's going on. Maybe something like:

abortStage(stage, s"Task serialization failed: $e\n${e.getStackTraceString}")

runningStages -= stage
return
}

logInfo("Submitting " + tasks.size + " missing tasks from " + stage + " (" + stage.rdd + ")")
Expand Down