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

UnsupportedOperationException - Refusing to marshal org.codehaus.groovy.runtime.GStringImpl

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: artifactory-plugin
    • Labels:
    • Environment:
      Jenkins v2.46.3
      Artifactory Plugin v2.11.0
      Pipeline v2.5
      Pipeline API v2.17
      Jenkins Master: Ubuntu 16.04.2 LTS
    • Similar Issues:

      Description

      After calling maven.run in the Artifactory Plugin, following Stack Trace appears.

      Since i didnt found any, Artifactory calls in the Stacktrace, my idea was that this could be a general Jenkins Problem, or my Pipeline script is broken. Either way, there should be a better Error Description.

      Pipeline:

      class MyArtifactory implements Serializable{
      
          def server
          def buildInfo
          def maven
      
          MyArtifactory(artifactory){
              this.server = artifactory.server('Artifactory')
              this.buildInfo = artifactory.newBuildInfo()
              this.maven = artifactory.newMavenBuild()
              
              this.maven.tool = 'Maven'
              this.maven.resolver server: server, releaseRepo: 'libs-release',       snapshotRepo: 'libs-snapshot'
              this.maven.deployer server: server, releaseRepo: 'libs-release-local', snapshotRepo: 'libs-snapshot-local', evenIfUnstable: false
          }
      
          def runMaven(inGoals, inOptions=""){
              this.maven.opts = inOptions
              this.maven.run pom: 'pom.xml', goals: inGoals, buildInfo: this.buildInfo
          }
      
          def publishBuildInfo(){
              this.server.publishBuildInfo this.buildInfo
          }
      }
      
      
      node('master'){
      
          def artifactory = new MyArtifactory(Artifactory);
          stage("Pack Artifact"){
              stash name: "ServerDeploy", excludes:"ci/**", includes: "Server.jar,SampleData.xml,*.bat,Configuration/**,Interfaces/**"
              artifactory.runMaven('install', '-Dfile=target/ServerDeploy.zip');
          }
      
      }
      

      Stacktrace:

      java.lang.UnsupportedOperationException: Refusing to marshal org.codehaus.groovy.runtime.GStringImpl for security reasons
      at hudson.util.XStream2$BlacklistedTypesConverter.marshal(XStream2.java:445)
      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)
      Caused: java.lang.RuntimeException: Failed to serialize groovy.lang.Binding#variables for class groovy.lang.Binding
      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.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
      at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:250)
      at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:226)
      at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.<init>(AbstractReflectionConverter.java:189)
      at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:135)
      at com.thoughtworks.xstream.converters.reflection.SerializableConverter.marshalUnserializableParent(SerializableConverter.java:292)
      at com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:246)
      at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:83)
      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)
      Caused: java.lang.RuntimeException: Failed to serialize org.jfrog.hudson.pipeline.types.MavenBuild#cpsScript for class org.jfrog.hudson.pipeline.types.MavenBuild
      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.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)
      Caused: 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)
      Caused: 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:170)
      at org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage.saveActions(SimpleXStreamFlowNodeStorage.java:111)
      at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$TimingFlowNodeStorage.saveActions(CpsFlowExecution.java:1491)
      at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.saveActions(CpsFlowExecution.java:1012)
      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:910)
      at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1221)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:407)
      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)
      

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            I'm removing pipeline-model-definition from the components - Declarative is more strict about serializability than Scripted is, but that's not a bug, that's just life. =)

            Show
            abayer Andrew Bayer added a comment - I'm removing pipeline-model-definition from the components - Declarative is more strict about serializability than Scripted is, but that's not a bug, that's just life. =)
            Hide
            jglick Jesse Glick added a comment -

            Andrew Bayer well it is not actually clear to me where the bug lies, and I suspected that it was really in pipeline-model-definition, since I did not see anything wrong in what artifactory was doing offhand.

            Show
            jglick Jesse Glick added a comment - Andrew Bayer well it is not actually clear to me where the bug lies, and I suspected that it was really in pipeline-model-definition , since I did not see anything wrong in what artifactory was doing offhand.
            Hide
            rzhou Ronnie Zhou added a comment -

            saw the same stacktrae in zd-57759 and https://support.cloudbees.com/hc/en-us/articles/234805187-SECURITY-360-Advisory fixed it.

            Show
            rzhou Ronnie Zhou added a comment - saw the same stacktrae in zd-57759 and https://support.cloudbees.com/hc/en-us/articles/234805187-SECURITY-360-Advisory  fixed it.
            Hide
            jglick Jesse Glick added a comment -

            I still suspect that pipeline-model-definition is involved here somehow, given the fact that the recent report involved the conjunction of a library with Declarative. (Not done in the normal way with a Declarative library section, but using Groovy code outside the pipeline block, which I suspect should be treated as a syntax error Andrew Bayer?)

            Show
            jglick Jesse Glick added a comment - I still suspect that pipeline-model-definition is involved here somehow, given the fact that the recent report  involved the conjunction of a library with Declarative. (Not done in the normal way with a Declarative library section, but using Groovy code outside the pipeline block, which I suspect should be treated as a syntax error Andrew Bayer ?)
            Hide
            abayer Andrew Bayer added a comment -

            I want to reject anything outside of pipeline as a syntax error, but that'll break a bunch of existing Pipelines, so things get wonkier. But that specific report is definitely a case of Declarative serializing the steps block (deliberately and correctly) but the library object throws things off due to containing a GString. I honestly don't know off the top of my head what the right behavior on Declarative's side here would be - need to think on it.

            Show
            abayer Andrew Bayer added a comment - I want to reject anything outside of pipeline as a syntax error, but that'll break a bunch of existing Pipelines, so things get wonkier. But that specific report is definitely a case of Declarative serializing the steps block (deliberately and correctly) but the library object throws things off due to containing a GString . I honestly don't know off the top of my head what the right behavior on Declarative's side here would be - need to think on it.

              People

              • Assignee:
                eyalbe Eyal Ben Moshe
                Reporter:
                raynig Simon Schneider
              • Votes:
                4 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated: