Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 29.4k
[SPARK-4204][Core][WebUI] Change Utils.exceptionString to contain the inner exceptions and make the error information in Web UI more friendly#3073
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
94f25661e50f71dfb0032a07057bca509d3176d1e3File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -83,15 +83,48 @@ case class FetchFailed( | ||
| * :: DeveloperApi :: | ||
| * Task failed due to a runtime exception. This is the most common failure case and also captures | ||
| * user program exceptions. | ||
| * | ||
| * `stackTrace` contains the stack trace of the exception itself. It still exists for backward | ||
| * compatibility. It's better that using `this(e: Throwable, metrics: Option[TaskMetrics])` to | ||
| * create `ExceptionFailure` as it will handle the backward compatibility properly. | ||
| * | ||
| * `fullStackTrace` is a better representation of the stack trace because it contains the whole | ||
| * stack trace including the exception and its causes | ||
| */ | ||
| @DeveloperApi | ||
| case class ExceptionFailure( | ||
| className: String, | ||
| description: String, | ||
| stackTrace: Array[StackTraceElement], | ||
| fullStackTrace: String, | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this warrants a comment in the javadoc for this class why we have | ||
| metrics: Option[TaskMetrics]) | ||
| extends TaskFailedReason { | ||
| override def toErrorString: String = Utils.exceptionString(className, description, stackTrace) | ||
| private[spark] def this(e: Throwable, metrics: Option[TaskMetrics]) { | ||
| this(e.getClass.getName, e.getMessage, e.getStackTrace, Utils.exceptionString(e), metrics) | ||
| } | ||
| override def toErrorString: String = | ||
| if (fullStackTrace == null) { | ||
| // fullStackTrace is added in 1.2.0 | ||
| // If fullStackTrace is null, use the old error string for backward compatibility | ||
| exceptionString(className, description, stackTrace) | ||
| } else { | ||
| fullStackTrace | ||
| } | ||
| /** | ||
| * Return a nice string representation of the exception, including the stack trace. | ||
| * Note: It does not include the exception's causes, and is only used for backward compatibility. | ||
| */ | ||
| private def exceptionString( | ||
| className: String, | ||
| description: String, | ||
| stackTrace: Array[StackTraceElement]): String = { | ||
| val desc = if (description == null) "" else description | ||
| val st = if (stackTrace == null) "" else stackTrace.map(" " + _).mkString("\n") | ||
| s"$className: $desc\n$st" | ||
| } | ||
| } | ||
| /** | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1596,19 +1596,19 @@ private[spark] object Utils extends Logging { | ||
| .orNull | ||
| } | ||
| /** Return a nice string representation of the exception, including the stack trace. */ | ||
| /** | ||
| * Return a nice string representation of the exception. It will call "printStackTrace" to | ||
| * recursively generate the stack trace including the exception and its causes. | ||
| */ | ||
| def exceptionString(e: Throwable): String = { | ||
| if (e == null) "" else exceptionString(getFormattedClassName(e), e.getMessage, e.getStackTrace) | ||
| } | ||
| /** Return a nice string representation of the exception, including the stack trace. */ | ||
| def exceptionString( | ||
| className: String, | ||
| description: String, | ||
| stackTrace: Array[StackTraceElement]): String = { | ||
| val desc = if (description == null) "" else description | ||
| val st = if (stackTrace == null) "" else stackTrace.map(" " + _).mkString("\n") | ||
| s"$className: $desc\n$st" | ||
| if (e == null) { | ||
| "" | ||
| } else { | ||
| // Use e.printStackTrace here because e.getStackTrace doesn't include the cause | ||
| val stringWriter = new StringWriter() | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add a comment here that says something like | ||
| e.printStackTrace(new PrintWriter(stringWriter)) | ||
| stringWriter.toString | ||
| } | ||
| } | ||
| /** | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"It's better to use", but I'll fix this when I merge it. (No action needed on your part)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.