Github user MattWhelan commented on a diff in the pull request:
https://github.com/apache/spark/pull/3233#discussion_r23413276
--- Diff:
core/src/main/scala/org/apache/spark/executor/ExecutorURLClassLoader.scala ---
@@ -32,36 +35,40 @@ private[spark] trait MutableURLClassLoader extends
ClassLoader {
}
private[spark] class ChildExecutorURLClassLoader(urls: Array[URL], parent:
ClassLoader)
- extends MutableURLClassLoader {
-
- private object userClassLoader extends URLClassLoader(urls, null){
- override def addURL(url: URL) {
- super.addURL(url)
- }
- override def findClass(name: String): Class[_] = {
- super.findClass(name)
- }
- }
+ extends URLClassLoader(urls, null) with MutableURLClassLoader {
private val parentClassLoader = new ParentClassLoader(parent)
- override def findClass(name: String): Class[_] = {
+ override def loadClass(name: String, resolve: Boolean): Class[_] = {
try {
- userClassLoader.findClass(name)
--- End diff --
You're bypassing the cache here. The normal order is cache, parent, self.
You're doing self, cache, parent, self. I think you probably want cache, self,
parent?
The problem with bypassing cache is that findClass doesn't seem to protect
against defining the same class twice, using the same bytes, which throws a
LinkageError.
Also, you need synchronization here. ClassLoader.loadClass(String,
boolean) synchronizes on 'this' in 1.6, and on a per-name lock in 1.7. The
former is prone to deadlocks in certain cases.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]