aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorReynold Xin <rxin@databricks.com>2016-03-25 01:17:23 -0700
committerReynold Xin <rxin@databricks.com>2016-03-25 01:17:23 -0700
commit70a6f0bb57ca2248444157e2707fbcc3cb04e3bc (patch)
treebf5d71237ea18b50668937647d678b378df3fb8a /core
parent20ddf5fddf40b543edc61d6e4687988489dea64c (diff)
downloadspark-70a6f0bb57ca2248444157e2707fbcc3cb04e3bc.tar.gz
spark-70a6f0bb57ca2248444157e2707fbcc3cb04e3bc.tar.bz2
spark-70a6f0bb57ca2248444157e2707fbcc3cb04e3bc.zip
[SPARK-14149] Log exceptions in tryOrIOException
## What changes were proposed in this pull request? We ran into a problem today debugging some class loading problem during deserialization, and JVM was masking the underlying exception which made it very difficult to debug. We can however log the exceptions using try/catch ourselves in serialization/deserialization. The good thing is that all these methods are already using Utils.tryOrIOException, so we can just put the try catch and logging in a single place. ## How was this patch tested? A logging change with a manual test. Author: Reynold Xin <rxin@databricks.com> Closes #11951 from rxin/SPARK-14149.
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/util/Utils.scala23
1 files changed, 6 insertions, 17 deletions
diff --git a/core/src/main/scala/org/apache/spark/util/Utils.scala b/core/src/main/scala/org/apache/spark/util/Utils.scala
index fe6063ce47..73768ff4c8 100644
--- a/core/src/main/scala/org/apache/spark/util/Utils.scala
+++ b/core/src/main/scala/org/apache/spark/util/Utils.scala
@@ -1194,21 +1194,6 @@ private[spark] object Utils extends Logging {
}
/**
- * Execute a block of code that evaluates to Unit, re-throwing any non-fatal uncaught
- * exceptions as IOException. This is used when implementing Externalizable and Serializable's
- * read and write methods, since Java's serializer will not report non-IOExceptions properly;
- * see SPARK-4080 for more context.
- */
- def tryOrIOException(block: => Unit) {
- try {
- block
- } catch {
- case e: IOException => throw e
- case NonFatal(t) => throw new IOException(t)
- }
- }
-
- /**
* Execute a block of code that returns a value, re-throwing any non-fatal uncaught
* exceptions as IOException. This is used when implementing Externalizable and Serializable's
* read and write methods, since Java's serializer will not report non-IOExceptions properly;
@@ -1218,8 +1203,12 @@ private[spark] object Utils extends Logging {
try {
block
} catch {
- case e: IOException => throw e
- case NonFatal(t) => throw new IOException(t)
+ case e: IOException =>
+ logError("Exception encountered", e)
+ throw e
+ case NonFatal(e) =>
+ logError("Exception encountered", e)
+ throw new IOException(e)
}
}