To recap, the idea in this code is to record classloader for each class that gets serialized during remoting, so that when deserialized on the remote node, we can correctly recreate multiple classloaders that are involved in the object graph. This code was introduced in rev.21002 and disabled back in rev.21356 after JENKINS-4293 was reported.
I temporarily resurrected this support to see if this solves JENKINS-4993, and instead I discovered a problem.
That is, the code successfully recover the relationship between instances and classes, and classes and their classloaders, but the resulting RemoteClassLoaders do not and cannot recreate relationship among them. Fixing up parent/child relationship won't be enough, as we have custom ClassLoader implementations like DependencyClassLoader. So this ends up loading duplicates of the same class in different classloader in the following scenario:
... because when the definition of B deserializes, its base class A is loaded by the RemoteClassLoader for Y, and not by the RemoteClassLoader for X.
To recap, the idea in this code is to record classloader for each class that gets serialized during remoting, so that when deserialized on the remote node, we can correctly recreate multiple classloaders that are involved in the object graph. This code was introduced in rev.21002 and disabled back in rev.21356 after
JENKINS-4293was reported.I temporarily resurrected this support to see if this solves
JENKINS-4993, and instead I discovered a problem.That is, the code successfully recover the relationship between instances and classes, and classes and their classloaders, but the resulting RemoteClassLoaders do not and cannot recreate relationship among them. Fixing up parent/child relationship won't be enough, as we have custom ClassLoader implementations like DependencyClassLoader. So this ends up loading duplicates of the same class in different classloader in the following scenario:
... because when the definition of B deserializes, its base class A is loaded by the RemoteClassLoader for Y, and not by the RemoteClassLoader for X.