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

GString kept unevaluated as long as StepDescriptor.newInstance (was: Pipeline build fails with serialization error when using string interpolation)

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • workflow-cps-plugin
    • None
    • Jenkins 2.57

      I get the following error for my Pipeline jobs after upgrading from 2.56 to 2.57 (also updated a bunch of plugins, so I can't be certain that the core upgrade is the culprit). See also the comment https://issues.jenkins-ci.org/browse/JENKINS-42524?focusedCommentId=297258&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-297258, which seems to be the exact same issue I'm having.

      java.lang.RuntimeException: Failed to serialize org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage$Tag#actions for class org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage$Tag
      	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:256)
      	at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
      	at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
      	at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
      	at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
      	at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
      	at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
      	at com.thoughtworks.xstream.XStream.marshal(XStream.java:1026)
      	at com.thoughtworks.xstream.XStream.marshal(XStream.java:1015)
      	at com.thoughtworks.xstream.XStream.toXML(XStream.java:988)
      	at hudson.XmlFile.write(XmlFile.java:171)
      	at org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage.saveActions(SimpleXStreamFlowNodeStorage.java:111)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.saveActions(CpsFlowExecution.java:918)
      	at org.jenkinsci.plugins.workflow.graph.FlowNode.save(FlowNode.java:380)
      	at org.jenkinsci.plugins.workflow.graph.FlowNode.persistSafe(FlowNode.java:386)
      	at org.jenkinsci.plugins.workflow.graph.FlowNode.access$100(FlowNode.java:61)
      	at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:346)
      	at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:336)
      	at java.util.AbstractList.add(AbstractList.java:108)
      	at hudson.model.Actionable.addAction(Actionable.java:152)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:897)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1110)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:402)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:35)
      	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:748)
      Caused by: java.lang.RuntimeException: Failed to serialize org.jenkinsci.plugins.workflow.cps.actions.ArgumentsActionImpl#arguments for class org.jenkinsci.plugins.workflow.cps.actions.ArgumentsActionImpl
      	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:256)
      	at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
      	at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
      	at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
      	at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
      	at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
      	at com.thoughtworks.xstream.converters.collections.ArrayConverter.marshal(ArrayConverter.java:45)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
      	at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
      	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
      	... 33 more
      Caused by: java.lang.UnsupportedOperationException: Refusing to marshal org.codehaus.groovy.runtime.GStringImpl for security reasons
      	at hudson.util.XStream2$BlacklistedTypesConverter.marshal(XStream2.java:452)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
      	at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
      	at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
      	at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
      	at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:79)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
      	at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
      	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
      

          [JENKINS-43934] GString kept unevaluated as long as StepDescriptor.newInstance (was: Pipeline build fails with serialization error when using string interpolation)

          Jesse Glick added a comment -

          Shouldn't all the arguments to a Step be inherently serializable though, to enable saving the groovy program?

          They are serializable by JBoss Marshalling. This is the first time someone is trying to serialize them via XStream, for which we call ClassFilter.

          Jesse Glick added a comment - Shouldn't all the arguments to a Step be inherently serializable though, to enable saving the groovy program? They are serializable by JBoss Marshalling. This is the first time someone is trying to serialize them via XStream, for which we call ClassFilter .

          Jesse Glick added a comment -

          strml Blue Ocean is in regular release. You should disable the experimental UC unless you know what you are doing.

          Jesse Glick added a comment - strml Blue Ocean is in regular release. You should disable the experimental UC unless you know what you are doing.

          Samuel Reed added a comment -

          Yes, I've done so now.

          Samuel Reed added a comment - Yes, I've done so now.

          Emil Styrke added a comment -

          Indeed, after downgrading Pipeline: Groovy and Pipeline: API from the stepstorage4-beta versions, my problems are gone. Thanks for the pointer!

          Emil Styrke added a comment - Indeed, after downgrading Pipeline: Groovy and Pipeline: API from the stepstorage4-beta versions, my problems are gone. Thanks for the pointer!

          Emil Styrke added a comment -

          Feel free to close this issue. Sorry for the noise!

          Emil Styrke added a comment - Feel free to close this issue. Sorry for the noise!

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/cps/DSL.java
          src/test/java/org/jenkinsci/plugins/workflow/DSLTest.java
          http://jenkins-ci.org/commit/workflow-cps-plugin/549ae9bdcc83289c0af71db5cc9ed67878b6a6eb
          Log:
          JENKINS-43934 Flatten GString’s found in step arguments, even when present in nested collections.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/cps/DSL.java src/test/java/org/jenkinsci/plugins/workflow/DSLTest.java http://jenkins-ci.org/commit/workflow-cps-plugin/549ae9bdcc83289c0af71db5cc9ed67878b6a6eb Log: JENKINS-43934 Flatten GString’s found in step arguments, even when present in nested collections.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/cps/DSL.java
          src/test/java/org/jenkinsci/plugins/workflow/DSLTest.java
          http://jenkins-ci.org/commit/workflow-cps-plugin/ef0d963f6d48101a87d69a34644495e075bffd8d
          Log:
          Merge pull request #123 from jglick/flattenGString

          JENKINS-43934 Flatten GString’s found in step arguments, even when present in nested collections

          Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/66f27532e341...ef0d963f6d48

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/cps/DSL.java src/test/java/org/jenkinsci/plugins/workflow/DSLTest.java http://jenkins-ci.org/commit/workflow-cps-plugin/ef0d963f6d48101a87d69a34644495e075bffd8d Log: Merge pull request #123 from jglick/flattenGString JENKINS-43934 Flatten GString’s found in step arguments, even when present in nested collections Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/66f27532e341...ef0d963f6d48

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/test/java/org/jenkinsci/plugins/workflow/DSLTest.java
          src/test/java/org/jenkinsci/plugins/workflow/cps/DSLTest.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/California.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicListStep.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicListWithSymbolStep.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicStep.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicWithSymbolStep.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/Nevada.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/NewYork.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/State.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/StateMetaStep.java
          http://jenkins-ci.org/commit/workflow-cps-plugin/c759f36ecdb31987547111e83e77d2f2b040c701
          Log:
          JENKINS-43934 Verifying that flattening logic also works for symbols—we do not need to explicitly traverse UninstantiatedDescribable.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/test/java/org/jenkinsci/plugins/workflow/DSLTest.java src/test/java/org/jenkinsci/plugins/workflow/cps/DSLTest.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/California.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicListStep.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicListWithSymbolStep.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicStep.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicWithSymbolStep.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/Nevada.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/NewYork.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/State.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/StateMetaStep.java http://jenkins-ci.org/commit/workflow-cps-plugin/c759f36ecdb31987547111e83e77d2f2b040c701 Log: JENKINS-43934 Verifying that flattening logic also works for symbols—we do not need to explicitly traverse UninstantiatedDescribable.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/test/java/org/jenkinsci/plugins/workflow/DSLTest.java
          src/test/java/org/jenkinsci/plugins/workflow/cps/DSLTest.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/California.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicListStep.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicListWithSymbolStep.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicStep.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicWithSymbolStep.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/Nevada.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/NewYork.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/State.java
          src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/StateMetaStep.java
          http://jenkins-ci.org/commit/workflow-cps-plugin/7101f717d0027528e3ff70b4c157258e17423f9e
          Log:
          Merge pull request #131 from jglick/extra-test-JENKINS-43934

          Extra test for JENKINS-43934

          Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/5f871a45f478...7101f717d002

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/test/java/org/jenkinsci/plugins/workflow/DSLTest.java src/test/java/org/jenkinsci/plugins/workflow/cps/DSLTest.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/California.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicListStep.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicListWithSymbolStep.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicStep.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicWithSymbolStep.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/Nevada.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/NewYork.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/State.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/StateMetaStep.java http://jenkins-ci.org/commit/workflow-cps-plugin/7101f717d0027528e3ff70b4c157258e17423f9e Log: Merge pull request #131 from jglick/extra-test- JENKINS-43934 Extra test for JENKINS-43934 Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/5f871a45f478...7101f717d002

          Sam Van Oort added a comment -

          Released fix with workflow-cps as of either 2.30 or 2.29

          Sam Van Oort added a comment - Released fix with workflow-cps as of either 2.30 or 2.29

            jglick Jesse Glick
            estyrke Emil Styrke
            Votes:
            2 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: