Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39699

regression: arrays of objects no longer serializable

    XMLWordPrintable

Details

    Description

      Following pipeline worked in Pipeline Groovy Plugin 2.22, but not in version 2.23:

      class C
      {
          String a;
          String b;
      };
      
      def C[] c = [
          [
              a:   "AAA",
              b:   "BBB"
          ]
      ];
      
      node {
      }
      

      In version 2.23 following exception is thrown instead:

      java.io.NotSerializableException: C
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:778)
      	at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
      	at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
      	at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
      	at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
      	at java.util.HashMap.internalWriteEntries(HashMap.java:1785)
      	at java.util.HashMap.writeObject(HashMap.java:1362)
      	at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
      	at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
      	at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
      	at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
      	at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
      	at java.util.HashMap.internalWriteEntries(HashMap.java:1785)
      	at java.util.HashMap.writeObject(HashMap.java:1362)
      	at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
      	at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
      	at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
      	at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:132)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:434)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:413)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:357)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: an exception which occurred:
      	in field locals
      	in field capture
      	in field def
      	in field closures
      	in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@189c557a
      Finished: FAILURE
      

      Attachments

        Issue Links

          Activity

            git Thomas Gimpel added a comment -

            Currently we are using arrays of objects in order to handle a large number of GIT repositories in the following way:

            class Repository
            {
                String name;
                String branch;
                String url;
            };
            
            /*
             * List of all GIT repositories
             */
            def Repository[] repositories = [
                [
                    name:   "repo1",
                    branch: branch1,
                    url:    "git@gitmaster:repo1.git"
                ], [
                    name:   "repo2",
                    branch: branch2,
                    url:    "git@gitmaster:repo2.git"
                ], [
                    name:   "repo3",
                    branch: branch3,
                    url:    "git@gitmaster:repo3.git"
                ]
            ];
            stage('GIT checkout') {
                 node() {
                    for (int i = 0; i < repositories.size(); i++) {
                       Repository repo = repos.get(i);
                       rmDir(repo.name);
                       //cloneGitRepository(repo.url, repo.branch, repo.name);
                    }
                 }
            }
            

            This code is broken with pipeline-groovy-plugin 2.23. Since we do not see a practicable alternative for the code above the issue is blocking for us now.

            git Thomas Gimpel added a comment - Currently we are using arrays of objects in order to handle a large number of GIT repositories in the following way: class Repository { String name; String branch; String url; }; /* * List of all GIT repositories */ def Repository[] repositories = [ [ name: "repo1" , branch: branch1, url: "git@gitmaster:repo1.git" ], [ name: "repo2" , branch: branch2, url: "git@gitmaster:repo2.git" ], [ name: "repo3" , branch: branch3, url: "git@gitmaster:repo3.git" ] ]; stage( 'GIT checkout' ) { node() { for ( int i = 0; i < repositories.size(); i++) { Repository repo = repos.get(i); rmDir(repo.name); //cloneGitRepository(repo.url, repo.branch, repo.name); } } } This code is broken with pipeline-groovy-plugin 2.23. Since we do not see a practicable alternative for the code above the issue is blocking for us now.
            jglick Jesse Glick added a comment -

            Not sure offhand how it could have worked in 2.22. You must declare C to be serializable.

            jglick Jesse Glick added a comment - Not sure offhand how it could have worked in 2.22. You must declare C to be serializable.

            People

              Unassigned Unassigned
              git Thomas Gimpel
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: