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

for in loop over result of String.split() gives NotSerializableException

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Similar to JENKINS-27421 (maybe the same, I cannot decide, please analyze).

      Following snippet produces the exception:

      node {
          def ARTIFACTS = "a01;a02".split(';')
          for (ARTIFACT in ARTIFACTS) {
              echo ARTIFACT
              build job: 'a', parameters: [[$class: 'StringParameterValue', name: 'ARTIFACT', value: ARTIFACT]]
          }
      }
      

      Exception thrown:

      java.io.NotSerializableException: java.util.AbstractList$Itr
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
      	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.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.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.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.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.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:343)
      	at java.util.TreeMap.writeObject(TreeMap.java:2274)
      	at sun.reflect.GeneratedMethodAccessor469.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	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:371)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:355)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:309)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:77)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:186)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:184)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	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:471)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: an exception which occurred:
      	in field itr
      	in field target
      	in field continue_
      	in field parent
      	in field caller
      	in field e
      	in field program
      	in field threads
      	in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@55ec5d96
      

      Current workaround is to use classic for loop.

      Using jenkins / plugin version 2.1

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            I need to know exact plugin versions. This should have been fixed in workflow-cps 2.1.

            Show
            jglick Jesse Glick added a comment - I need to know exact plugin versions. This should have been fixed in workflow-cps 2.1 .
            Hide
            csomogyi Csongor Somogyi added a comment -

            I just checked it's still occurring with the latest patches installed.

            $ for p in $(find . -type d -maxdepth 1 | sed 's/\.\///' | sort); do echo $p; grep Plugin-Version $p/META-INF/MANIFEST.MF; done
            find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.
            
            .
            grep: ./META-INF/MANIFEST.MF: No such file or directory
            ace-editor
            Plugin-Version: 1.1
            ant
            Plugin-Version: 1.3
            antisamy-markup-formatter
            Plugin-Version: 1.3
            branch-api
            Plugin-Version: 1.8
            build-name-setter
            Plugin-Version: 1.6.5
            build-pipeline-plugin
            Plugin-Version: 1.5.2
            build-timeout
            Plugin-Version: 1.16
            build-timestamp
            Plugin-Version: 1.0.1
            build-with-parameters
            Plugin-Version: 1.3
            cloudbees-folder
            Plugin-Version: 5.10
            copyartifact
            Plugin-Version: 1.38
            credentials
            Plugin-Version: 1.28
            credentials-binding
            Plugin-Version: 1.7
            dashboard-view
            Plugin-Version: 2.9.7
            durable-task
            Plugin-Version: 1.9
            dynamicparameter
            Plugin-Version: 0.2.0
            email-ext
            Plugin-Version: 2.42
            extended-choice-parameter
            Plugin-Version: 0.72
            extensible-choice-parameter
            Plugin-Version: 1.3.2
            external-monitor-job
            Plugin-Version: 1.4
            git
            Plugin-Version: 2.4.4
            git-client
            Plugin-Version: 1.19.6
            git-server
            Plugin-Version: 1.6
            handlebars
            Plugin-Version: 1.1.1
            hidden-parameter
            Plugin-Version: 0.0.4
            icon-shim
            Plugin-Version: 2.0.3
            javadoc
            Plugin-Version: 1.3
            jquery
            Plugin-Version: 1.11.2-0
            jquery-detached
            Plugin-Version: 1.2.1
            junit
            Plugin-Version: 1.13
            ldap
            Plugin-Version: 1.12
            mailer
            Plugin-Version: 1.17
            mapdb-api
            Plugin-Version: 1.0.6.0
            matrix-auth
            Plugin-Version: 1.3.2
            matrix-project
            Plugin-Version: 1.6
            maven-info
            Plugin-Version: 0.2.0
            maven-plugin
            Plugin-Version: 2.12.1
            momentjs
            Plugin-Version: 1.1.1
            nexus-artifact-uploader
            Plugin-Version: 2.1.2
            pam-auth
            Plugin-Version: 1.2
            parameterized-trigger
            Plugin-Version: 2.30
            pipeline-build-step
            Plugin-Version: 2.0
            pipeline-input-step
            Plugin-Version: 2.0
            pipeline-rest-api
            Plugin-Version: 1.4
            pipeline-stage-step
            Plugin-Version: 2.1
            pipeline-stage-view
            Plugin-Version: 1.4
            plain-credentials
            Plugin-Version: 1.1
            random-string-parameter
            Plugin-Version: 1.0
            role-strategy
            Plugin-Version: 2.2.0
            scm-api
            Plugin-Version: 1.2
            scriptler
            Plugin-Version: 2.9
            script-security
            Plugin-Version: 1.19
            ssh
            Plugin-Version: 2.4
            ssh-agent
            Plugin-Version: 1.10
            ssh-credentials
            Plugin-Version: 1.12
            ssh-slaves
            Plugin-Version: 1.11
            structs
            Plugin-Version: 1.1
            subversion
            Plugin-Version: 2.5.7
            timestamper
            Plugin-Version: 1.8.2
            token-macro
            Plugin-Version: 1.12.1
            validating-string-parameter
            Plugin-Version: 2.3
            windows-slaves
            Plugin-Version: 1.1
            workflow-aggregator
            Plugin-Version: 2.1
            workflow-api
            Plugin-Version: 2.0
            workflow-basic-steps
            Plugin-Version: 2.0
            workflow-cps
            Plugin-Version: 2.2
            workflow-cps-global-lib
            Plugin-Version: 2.0
            workflow-durable-task-step
            Plugin-Version: 2.0
            workflow-job
            Plugin-Version: 2.1
            workflow-multibranch
            Plugin-Version: 2.3
            workflow-scm-step
            Plugin-Version: 2.0
            workflow-step-api
            Plugin-Version: 2.0
            workflow-support
            Plugin-Version: 2.0
            ws-cleanup
            Plugin-Version: 0.29
            
            Show
            csomogyi Csongor Somogyi added a comment - I just checked it's still occurring with the latest patches installed. $ for p in $(find . -type d -maxdepth 1 | sed 's/\.\///' | sort); do echo $p; grep Plugin-Version $p/META-INF/MANIFEST.MF; done find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments. . grep: ./META-INF/MANIFEST.MF: No such file or directory ace-editor Plugin-Version: 1.1 ant Plugin-Version: 1.3 antisamy-markup-formatter Plugin-Version: 1.3 branch-api Plugin-Version: 1.8 build-name-setter Plugin-Version: 1.6.5 build-pipeline-plugin Plugin-Version: 1.5.2 build-timeout Plugin-Version: 1.16 build-timestamp Plugin-Version: 1.0.1 build-with-parameters Plugin-Version: 1.3 cloudbees-folder Plugin-Version: 5.10 copyartifact Plugin-Version: 1.38 credentials Plugin-Version: 1.28 credentials-binding Plugin-Version: 1.7 dashboard-view Plugin-Version: 2.9.7 durable-task Plugin-Version: 1.9 dynamicparameter Plugin-Version: 0.2.0 email-ext Plugin-Version: 2.42 extended-choice-parameter Plugin-Version: 0.72 extensible-choice-parameter Plugin-Version: 1.3.2 external-monitor-job Plugin-Version: 1.4 git Plugin-Version: 2.4.4 git-client Plugin-Version: 1.19.6 git-server Plugin-Version: 1.6 handlebars Plugin-Version: 1.1.1 hidden-parameter Plugin-Version: 0.0.4 icon-shim Plugin-Version: 2.0.3 javadoc Plugin-Version: 1.3 jquery Plugin-Version: 1.11.2-0 jquery-detached Plugin-Version: 1.2.1 junit Plugin-Version: 1.13 ldap Plugin-Version: 1.12 mailer Plugin-Version: 1.17 mapdb-api Plugin-Version: 1.0.6.0 matrix-auth Plugin-Version: 1.3.2 matrix-project Plugin-Version: 1.6 maven-info Plugin-Version: 0.2.0 maven-plugin Plugin-Version: 2.12.1 momentjs Plugin-Version: 1.1.1 nexus-artifact-uploader Plugin-Version: 2.1.2 pam-auth Plugin-Version: 1.2 parameterized-trigger Plugin-Version: 2.30 pipeline-build-step Plugin-Version: 2.0 pipeline-input-step Plugin-Version: 2.0 pipeline-rest-api Plugin-Version: 1.4 pipeline-stage-step Plugin-Version: 2.1 pipeline-stage-view Plugin-Version: 1.4 plain-credentials Plugin-Version: 1.1 random-string-parameter Plugin-Version: 1.0 role-strategy Plugin-Version: 2.2.0 scm-api Plugin-Version: 1.2 scriptler Plugin-Version: 2.9 script-security Plugin-Version: 1.19 ssh Plugin-Version: 2.4 ssh-agent Plugin-Version: 1.10 ssh-credentials Plugin-Version: 1.12 ssh-slaves Plugin-Version: 1.11 structs Plugin-Version: 1.1 subversion Plugin-Version: 2.5.7 timestamper Plugin-Version: 1.8.2 token-macro Plugin-Version: 1.12.1 validating-string-parameter Plugin-Version: 2.3 windows-slaves Plugin-Version: 1.1 workflow-aggregator Plugin-Version: 2.1 workflow-api Plugin-Version: 2.0 workflow-basic-steps Plugin-Version: 2.0 workflow-cps Plugin-Version: 2.2 workflow-cps-global-lib Plugin-Version: 2.0 workflow-durable-task-step Plugin-Version: 2.0 workflow-job Plugin-Version: 2.1 workflow-multibranch Plugin-Version: 2.3 workflow-scm-step Plugin-Version: 2.0 workflow-step-api Plugin-Version: 2.0 workflow-support Plugin-Version: 2.0 ws-cleanup Plugin-Version: 0.29
            Hide
            autarchprinceps autarch princeps added a comment - - edited

            I have the same issue, it is not fixed. My workflow-cps version is 2.39.

            Show
            autarchprinceps autarch princeps added a comment - - edited I have the same issue, it is not fixed. My workflow-cps version is 2.39.
            Hide
            nicolasproton Nicolas Proton added a comment -

            Same issue here, currently using workflow-cps 2.36

            Show
            nicolasproton Nicolas Proton added a comment - Same issue here, currently using workflow-cps 2.36
            Hide
            jglick Jesse Glick added a comment -

            Specific to array iteration. Fix filed.

            Show
            jglick Jesse Glick added a comment - Specific to array iteration. Fix filed.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/cps/persistence/IteratorHack.java
            src/test/java/org/jenkinsci/plugins/workflow/cps/persistence/IteratorHackTest.java
            http://jenkins-ci.org/commit/workflow-cps-plugin/bc3c49ec9e375c599d9c6ca1a11b23df018ebb6f
            Log:
            [FIXED JENKINS-34645] Serializable array iterator.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/cps/persistence/IteratorHack.java src/test/java/org/jenkinsci/plugins/workflow/cps/persistence/IteratorHackTest.java http://jenkins-ci.org/commit/workflow-cps-plugin/bc3c49ec9e375c599d9c6ca1a11b23df018ebb6f Log: [FIXED JENKINS-34645] Serializable array iterator.
            Hide
            abayer Andrew Bayer added a comment -

            Will be included in the upcoming workflow-cps 2.40 release.

            Show
            abayer Andrew Bayer added a comment - Will be included in the upcoming workflow-cps 2.40 release.

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                csomogyi Csongor Somogyi
              • Votes:
                1 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: