• Icon: Task Task
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None

      I'm using this issue to keep track of the MultiClassLoaderSerializer support that was partially implemented then disabled in JENKINS-4293.

          [JENKINS-5048] Resurrect MultiClassLoaderSerializer support

          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:

          ClassLoader X owns:
            class A {
              A data;
            }
          
          ClassLoader Y, which delegates to X, owns:
            class B extends A {}
          
          instance to be serialized: A(B)
          

          ... 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.

          Kohsuke Kawaguchi added a comment - 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: ClassLoader X owns: class A { A data; } ClassLoader Y, which delegates to X, owns: class B extends A {} instance to be serialized: A(B) ... 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.

          Code changed in hudson
          User: : kohsuke
          Path:
          trunk/hudson/main/core/src/main/java/hudson/ClassicPluginStrategy.java
          trunk/hudson/main/remoting/src/main/java/hudson/remoting/Capability.java
          trunk/hudson/main/remoting/src/main/java/hudson/remoting/MultiClassLoaderSerializer.java
          trunk/hudson/main/remoting/src/main/java/hudson/remoting/RemoteClassLoader.java
          trunk/hudson/main/remoting/src/test/java/hudson/remoting/ChannelTest.java
          http://fisheye4.cenqua.com/changelog/hudson/?cs=24490
          Log:
          JENKINS-5048 Fixed the multi-classloader support in the remoting code. I confirmed that this fixes JENKINS-4993 without modifying the warnings/analysis-core plugin.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : kohsuke Path: trunk/hudson/main/core/src/main/java/hudson/ClassicPluginStrategy.java trunk/hudson/main/remoting/src/main/java/hudson/remoting/Capability.java trunk/hudson/main/remoting/src/main/java/hudson/remoting/MultiClassLoaderSerializer.java trunk/hudson/main/remoting/src/main/java/hudson/remoting/RemoteClassLoader.java trunk/hudson/main/remoting/src/test/java/hudson/remoting/ChannelTest.java http://fisheye4.cenqua.com/changelog/hudson/?cs=24490 Log: JENKINS-5048 Fixed the multi-classloader support in the remoting code. I confirmed that this fixes JENKINS-4993 without modifying the warnings/analysis-core plugin.

          Code changed in hudson
          User: : kohsuke
          Path:
          trunk/www/changelog.html
          http://fisheye4.cenqua.com/changelog/hudson/?cs=24567
          Log:
          [FIXED JENKINS-5048] noting the resurrection of multi classloader support in the remoting in 1.337

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : kohsuke Path: trunk/www/changelog.html http://fisheye4.cenqua.com/changelog/hudson/?cs=24567 Log: [FIXED JENKINS-5048] noting the resurrection of multi classloader support in the remoting in 1.337

            Unassigned Unassigned
            kohsuke Kohsuke Kawaguchi
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: