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

triggerRemoteJob returns Refusing to marshal java.util.concurrent.Semaphore for security reasons

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • Jenkins versions 2.204.1 and CloudBees Jenkins Enterprise 2.263.2.3-rolling

      We use the parameterized-remote-trigger-plugin via groovy scripting.

      ServerA is running Jenkins 2.204.1

      ServerB is running CloudBees Jenkins Enterprise 2.263.2.3

      I am able to workaround the issue by placing the call to triggerRemoteJob with a catchError block, forcing the build and stage status to 'SUCCESS'.

      groovy scripts running on ServerA have no problems triggering jobs on ServerB

      groovy scripts on ServerB are throwing errors triggering jobs on ServerA

      • the job on ServerA starts
      • the job on ServerB reports an error

      Groovy script does:

      def remoteTestJob = triggerRemoteJob remoteJenkinsName: "remote-server",
          job: "remote-job",
          token: remote-job-token,
          parameters: "UPSTREAMBUILDNAME=mybld",
          maxConn: 5,
          shouldNotFailBuild: true,
          blockBuildUntilComplete: false

      ServerB Jenkins Console output:
      09:45:58 Warning: Invoking ambiguous Pipeline Step ‘triggerRemoteJob’ (org.jenkinsci.plugins.ParameterizedRemoteTrigger.pipeline.RemoteBuildPipelineStep). ‘triggerRemoteJob’ could refer to any of the following steps: [org.jenkinsci.plugins.ParameterizedRemoteTrigger.pipeline.RemoteBuildPipelineStep, com.cloudbees.opscenter.triggers.RemoteTriggerBuilderStep]. You can invoke steps by class name instead to avoid ambiguity. For example: steps.'org.jenkinsci.plugins.ParameterizedRemoteTrigger.pipeline.RemoteBuildPipelineStep'(...)09:45:58 ################################################################################################################09:45:58 Parameterized Remote Trigger Configuration:09:45:58 - job: remote-job 09:45:58 - remoteJenkinsName: remote-server*09:45:58* - parameters: [UPSTREAMBUILDNAME=mybld]09:45:58 - blockBuildUntilComplete: false*09:45:58* - connectionRetryLimit: 5*09:45:58* - trustAllCertificates: true*09:45:58* ################################################################################################################09:45:58 [Pipeline] }09:45:58 an exception which occurred:09:45:58 in field org.jenkinsci.plugins.ParameterizedRemoteTrigger.pipeline.RemoteBuildPipelineStep$Execution.remoteBuildConfig*09:45:58* in object org.jenkinsci.plugins.ParameterizedRemoteTrigger.pipeline.RemoteBuildPipelineStep$Execution@712870c3*09:45:58* in field org.jenkinsci.plugins.workflow.cps.CpsThread.step*09:45:58* in object org.jenkinsci.plugins.workflow.cps.CpsThread@71192189*09:45:58* in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.threads*09:45:58* in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@2faaf65d*09:45:58* in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@2faaf65d*09:45:58* Caused: java.lang.UnsupportedOperationException: Refusing to marshal java.util.concurrent.Semaphore for security reasons; see https://jenkins.io/redirect/class-filter/09:45:58 at hudson.util.XStream2$BlacklistedTypesConverter.marshal(XStream2.java:541)09:45:58 at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)09:45:58 at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)09:45:58 at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)09:45:58 at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)09:45:58 at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)09:45:58 at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:79)09:45:58 at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)09:45:58 at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)09:45:58 at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)09:45:58 at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:272)09:45:58 at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:259)09:45:58 Caused: java.lang.RuntimeException: Failed to serialize org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration#hostLocks for class org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration*09:45:58* at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:263)09:45:58 at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:231)09:45:58 at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)09:45:58 at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:217)09:45:58 at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:158)09:45:58 at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)09:45:58 at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)09:45:58 at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)09:45:58 at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)09:45:58 at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)09:45:58 at com.thoughtworks.xstream.XStream.marshal(XStream.java:1026)09:45:58 at com.thoughtworks.xstream.XStream.marshal(XStream.java:1015)09:45:58 at com.thoughtworks.xstream.XStream.toXML(XStream.java:988)09:45:58 at com.thoughtworks.xstream.XStream.toXML(XStream.java:975)09:45:58 at org.jenkinsci.plugins.workflow.support.pickles.XStreamPickle.<init>(XStreamPickle.java:46)09:45:58 at com.cloudbees.workflow.template.DescribablePickleFactory.pickle(DescribablePickleFactory.java:18)09:45:58 at com.cloudbees.workflow.template.DescribablePickleFactory.pickle(DescribablePickleFactory.java:15)09:45:58 at org.jenkinsci.plugins.workflow.support.pickles.SingleTypedPickleFactory.writeReplace(SingleTypedPickleFactory.java:49)09:45:58 at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter$1.writeReplace(RiverWriter.java:125)09:45:58 at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:186)09:45:58 at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)09:45:58 at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)09:45:58 at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)09:45:58 at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)09:45:58 at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)09:45:58 at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)09:45:58 at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)09:45:58 at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)09:45:58 at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)09:45:58 at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)09:45:58 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)09:45:58 at java.util.concurrent.ConcurrentSkipListMap.writeObject(ConcurrentSkipListMap.java:1437)09:45:58 at sun.reflect.GeneratedMethodAccessor364.invoke(Unknown Source)09:45:58 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)09:45:58 at java.lang.reflect.Method.invoke(Method.java:498)09:45:58 at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)09:45:58 at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:191)09:45:58 at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1028)09:45:58 at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)09:45:58 at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)09:45:58 at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)09:45:58 at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)09:45:58 at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)09:45:58 at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)09:45:58 at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.lambda$writeObject$0(RiverWriter.java:144)09:45:58 at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:237)09:45:58 at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:143)09:45:58 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:557)09:45:58 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:534)09:45:58 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:517)09:45:58 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:441)09:45:58 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)09:45:58 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312)09:45:58 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276)09:45:58 at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)09:45:58 at java.util.concurrent.FutureTask.run(FutureTask.java:266)09:45:58 at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:136)09:45:58 at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)09:45:58 at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)09:45:58 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)09:45:58 at java.util.concurrent.FutureTask.run(FutureTask.java:266)09:45:58 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)09:45:58 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)09:45:58 at java.lang.Thread.run(Thread.java:748)

            cashlalala KaiHsiang Chang
            bgriffinamd Beth Griffin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: