diff options
author | Andrew Or <andrew@databricks.com> | 2015-04-28 00:38:14 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2015-04-28 00:38:14 -0700 |
commit | bf35edd9d4b8b11df9f47b6ff43831bc95f06322 (patch) | |
tree | 00db68b1029ae3d5ca0b71c32427fd6fda1cd097 /core | |
parent | 9e4e82b7bca1129bcd5e0274b9ae1b1be3fb93da (diff) | |
download | spark-bf35edd9d4b8b11df9f47b6ff43831bc95f06322.tar.gz spark-bf35edd9d4b8b11df9f47b6ff43831bc95f06322.tar.bz2 spark-bf35edd9d4b8b11df9f47b6ff43831bc95f06322.zip |
[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
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/scala/org/apache/spark/serializer/SerializationDebugger.scala | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/src/main/scala/org/apache/spark/serializer/SerializationDebugger.scala b/core/src/main/scala/org/apache/spark/serializer/SerializationDebugger.scala index cecb992579..5abfa467c0 100644 --- a/core/src/main/scala/org/apache/spark/serializer/SerializationDebugger.scala +++ b/core/src/main/scala/org/apache/spark/serializer/SerializationDebugger.scala @@ -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 } |