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

java.io.NotSerializableException: Deleting job raises exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • core, job-dsl-plugin
    • Jenkins (2.303.1) running on Win10 VM, JobDSL Plugin with version 1.77.

      In our current configuration at the beginning of a pipeline Jenkins jobs are updated, created, or delete via jobDSL depending on the git branch given to the pipeline.

      Creating and updating is (so far) working without any issues shown. However, when a job needs to be deleted the jobDSL plugin raises the exception (see below).

      The jobDSL plugin is fed by a groovy file generating multiple (>100) jobs. They differe by name and can have different labels, command lines within the powershell command processed during the job itself, and location, where to copy artifcats from.

      When the exception is raise the job, needed to be deleted, is now "only" disabled. The plugin is configured to delete. For gaining couriosity the exception is only raise, if the job to be deleted has at least one run. Or the other way round: Deleting jobs, that never run, do not result in any issue.

      We recently updated Jenkins to 2.303.1 from somewhere 2.250ish. We cannot say for sure, that this problem started with this update, but we think it is very likely.

      Exception copied from Jenkins job log:
      (Path and job names are changed.)

      13:52:23 GeneratedJob{name='abc/def/ghi/job123'}
      13:52:23 Unreferenced items:
      13:52:23 GeneratedJob{name='abc/def/job050'}
      13:52:23 FATAL: java.lang.RuntimeException: Failed to serialize hudson.model.Project#builders for class hudson.model.FreeStyleProject
      13:52:23 java.io.NotSerializableException: The calling thread ThreadExecutor #3 for master : executing abc/def/jkl/dslJob #168,5,main has no associated channel. The current object hudson.remoting.RemoteOutputStream@240cca17 is interface org.jenkinsci.remoting.SerializableOnlyOverRemoting, but it is likely being serialized/deserialized without the channel
      13:52:23 at org.jenkinsci.remoting.SerializableOnlyOverRemoting.getChannelForSerialization(SerializableOnlyOverRemoting.java:67)
      13:52:23 at hudson.remoting.RemoteOutputStream.writeObject(RemoteOutputStream.java:84)
      13:52:23 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      13:52:23 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      13:52:23 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      13:52:23 at java.lang.reflect.Method.invoke(Method.java:498)
      13:52:23 at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
      13:52:23 Caused: com.thoughtworks.xstream.converters.ConversionException: Failed calling method
      13:52:23 ---- Debugging information ----
      13:52:23 message : Failed calling method
      13:52:23 cause-exception : java.io.NotSerializableException
      13:52:23 cause-message : The calling thread ThreadExecutor #3 for master : executing abc/def/jkl/dslJob #168,5,main has no associated channel. The current object hudson.remoting.RemoteOutputStream@240cca17 is interface org.jenkinsci.remoting.SerializableOnlyOverRemoting, but it is likely being serialized/deserialized without the channel
      13:52:23 method : hudson.remoting.RemoteOutputStream.writeObject()
      13:52:23 -------------------------------
      13:52:23 at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:158)
      13:52:23 at com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:257)
      13:52:23 at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
      13:52:23 at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
      13:52:23 at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      13:52:23 at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
      13:52:23 at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
      13:52:23 at com.thoughtworks.xstream.converters.reflection.SerializableConverter$1.writeToStream(SerializableConverter.java:139)
      13:52:23 at com.thoughtworks.xstream.core.util.CustomObjectOutputStream.writeObjectOverride(CustomObjectOutputStream.java:87)
      13:52:23 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
      13:52:23 at hudson.util.StreamTaskListener.writeObject(StreamTaskListener.java:168)
      13:52:23 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      13:52:23 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      13:52:23 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      13:52:23 at java.lang.reflect.Method.invoke(Method.java:498)
      13:52:23 at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
      13:52:23 Caused: com.thoughtworks.xstream.converters.ConversionException: Failed calling method
      13:52:23 ---- Debugging information ----
      13:52:23 message : Failed calling method
      13:52:23 cause-exception : com.thoughtworks.xstream.converters.ConversionException
      13:52:23 cause-message : Failed calling method
      13:52:23 method : hudson.model.StreamBuildListener.writeObject()
      13:52:23 -------------------------------
      13:52:23 at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:158)
      13:52:23 at com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:257)
      13:52:23 at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
      13:52:23 at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
      13:52:23 at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      13:52:23 at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
      13:52:23 at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:278)
      13:52:23 at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:265)
      13:52:23 Caused: java.lang.RuntimeException: Failed to serialize hudson.plugins.powershell.PowerShell#listener for class hudson.plugins.powershell.PowerShell
      13:52:23 at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:269)
      13:52:23 at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:236)
      13:52:23 at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:150)
      13:52:23 at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:221)
      13:52:23 at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:160)
      13:52:23 at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
      13:52:23 at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      13:52:23 at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
      13:52:23 at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
      13:52:23 at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeBareItem(AbstractCollectionConverter.java:94)
      13:52:23 at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:66)
      13:52:23 at hudson.util.DescribableList$ConverterImpl.marshal(DescribableList.java:274)
      13:52:23 at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
      13:52:23 at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      13:52:23 at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
      13:52:23 at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:278)
      13:52:23 at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:265)
      13:52:23 Caused: java.lang.RuntimeException: Failed to serialize hudson.model.Project#builders for class hudson.model.FreeStyleProject
      13:52:23 at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:269)
      13:52:23 at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:236)
      13:52:23 at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:150)
      13:52:23 at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:221)
      13:52:23 at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:160)
      13:52:23 at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
      13:52:23 at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      13:52:23 at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
      13:52:23 at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
      13:52:23 at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
      13:52:23 at com.thoughtworks.xstream.XStream.marshal(XStream.java:1278)
      13:52:23 at com.thoughtworks.xstream.XStream.marshal(XStream.java:1267)
      13:52:23 at com.thoughtworks.xstream.XStream.toXML(XStream.java:1240)
      13:52:23 at hudson.XmlFile.write(XmlFile.java:195)
      13:52:23 Caused: java.io.IOException
      13:52:23 at hudson.XmlFile.write(XmlFile.java:202)
      13:52:23 at hudson.model.AbstractItem.save(AbstractItem.java:622)
      13:52:23 at hudson.model.Job.save(Job.java:190)
      13:52:23 at hudson.model.AbstractProject.save(AbstractProject.java:287)
      13:52:23 at jenkins.model.ParameterizedJobMixIn$ParameterizedJob.makeDisabled(ParameterizedJobMixIn.java:484)
      13:52:23 at hudson.model.AbstractProject.performDelete(AbstractProject.java:352)
      13:52:23 at hudson.model.AbstractItem.delete(AbstractItem.java:798)
      13:52:23 at hudson.model.Job.delete(Job.java:684)
      13:52:23 at javaposse.jobdsl.plugin.ExecuteDslScripts.updateGeneratedJobs(ExecuteDslScripts.java:467)
      13:52:23 at javaposse.jobdsl.plugin.ExecuteDslScripts.perform(ExecuteDslScripts.java:364)
      13:52:23 at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
      13:52:23 at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
      13:52:23 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:21)
      13:52:23 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:808)
      13:52:23 at hudson.model.Build$BuildExecution.build(Build.java:199)
      13:52:23 at hudson.model.Build$BuildExecution.doRun(Build.java:164)
      13:52:23 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:516)
      13:52:23 at hudson.model.Run.execute(Run.java:1889)
      13:52:23 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      13:52:23 at hudson.model.ResourceController.execute(ResourceController.java:100)
      13:52:23 at hudson.model.Executor.run(Executor.java:433)
      13:52:23 Finished: FAILURE

       

      If you need any further information, please feel free to ask.
      Thank you all for helping!

            jamietanna Jamie Tanna
            dmarzahl Daniel-Timo
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: