Skip to content

Commit 4fa0582

Browse files
committed
Log failures in REPL class loading
1 parent 9a151ce commit 4fa0582

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

repl/src/main/scala/org/apache/spark/repl/ExecutorClassLoader.scala

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818
package org.apache.spark.repl
1919

20-
import java.io.{ByteArrayOutputStream, InputStream}
20+
import java.io.{ByteArrayOutputStream, InputStream, FileNotFoundException}
2121
import java.net.{URI, URL, URLEncoder}
2222
import java.util.concurrent.{Executors, ExecutorService}
2323

2424
import org.apache.hadoop.fs.{FileSystem, Path}
2525

26-
import org.apache.spark.{SparkConf, SparkEnv}
26+
import org.apache.spark.{SparkConf, SparkEnv, Logging}
2727
import org.apache.spark.deploy.SparkHadoopUtil
2828
import org.apache.spark.util.Utils
2929
import org.apache.spark.util.ParentClassLoader
@@ -37,7 +37,7 @@ import com.esotericsoftware.reflectasm.shaded.org.objectweb.asm.Opcodes._
3737
* Allows the user to specify if user class path should be first
3838
*/
3939
class ExecutorClassLoader(conf: SparkConf, classUri: String, parent: ClassLoader,
40-
userClassPathFirst: Boolean) extends ClassLoader {
40+
userClassPathFirst: Boolean) extends ClassLoader with Logging {
4141
val uri = new URI(classUri)
4242
val directory = uri.getPath
4343

@@ -91,7 +91,14 @@ class ExecutorClassLoader(conf: SparkConf, classUri: String, parent: ClassLoader
9191
inputStream.close()
9292
Some(defineClass(name, bytes, 0, bytes.length))
9393
} catch {
94-
case e: Exception => None
94+
case e: FileNotFoundException =>
95+
// We did not find the class
96+
logDebug(s"Did not load class $name from REPL class server at $uri", e)
97+
None
98+
case e: Exception =>
99+
// Something bad happened while checking if the class exists
100+
logError(s"Failed to check existence of class $name on REPL class server at $uri", e)
101+
None
95102
}
96103
}
97104

0 commit comments

Comments
 (0)