Skip to content
Snippets Groups Projects
Commit bf35edd9 authored by Andrew Or's avatar Andrew Or Committed by Reynold Xin
Browse files

[SPARK-7187] SerializationDebugger should not crash user code

rxin

Author: Andrew Or <andrew@databricks.com>

Closes #5734 from andrewor14/ser-deb and squashes the following commits:

e8aad6c [Andrew Or] NonFatal
57d0ef4 [Andrew Or] try catch improveException
parent 9e4e82b7
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,7 @@ import java.security.AccessController
import scala.annotation.tailrec
import scala.collection.mutable
import scala.util.control.NonFatal
import org.apache.spark.Logging
......@@ -35,8 +36,15 @@ private[serializer] object SerializationDebugger extends Logging {
*/
def improveException(obj: Any, e: NotSerializableException): NotSerializableException = {
if (enableDebugging && reflect != null) {
new NotSerializableException(
e.getMessage + "\nSerialization stack:\n" + find(obj).map("\t- " + _).mkString("\n"))
try {
new NotSerializableException(
e.getMessage + "\nSerialization stack:\n" + find(obj).map("\t- " + _).mkString("\n"))
} catch {
case NonFatal(t) =>
// Fall back to old exception
logWarning("Exception in serialization debugger", t)
e
}
} else {
e
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment