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

MultiJob has a forbidden nested reference to a model object

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • multijob-plugin
    • None
    • multijob:1.28
      core:2.89.3

    Description

      When running a simple, the Jenkins logs show the following WARNINGS:

      Feb 02, 2018 9:47:26 AM hudson.XmlFile replaceIfNotAtTopLevel
      WARNING: JENKINS-45892: reference to job1 #2 being saved from unexpected /tmp/Jenkins/jobs/testSimpleMutliJob/builds/2/build.xml
      java.lang.IllegalStateException
      	at hudson.XmlFile.replaceIfNotAtTopLevel(XmlFile.java:210)
      	at hudson.model.Run.writeReplace(Run.java:1929)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callWriteReplace(SerializationMethodInvoker.java:89)
      	at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:141)
      	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)
      	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.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.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
      	at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
      	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
      	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:181)
      	at hudson.model.Run.save(Run.java:1920)
      	at hudson.model.Run.execute(Run.java:1781)
      	at com.tikal.jenkins.plugins.multijob.MultiJobBuild.run(MultiJobBuild.java:73)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:421)
      

      How to Reproduce

      • Create a simple job that does nothing
      • Create a simple MultiJob project with one phase, which contains the reference to the job, see multijob-config.png
      • Build the MultiJob

      You will see the stacktrace appearing several times (3 times), see logs-after-build.log

      Impact

      This is critical as when many jobs run at the same time, it is polluting at such extent that it slow down the Jenkins server and make it unresponsive.

      Attachments

        Issue Links

          Activity

            chenc Chen Cohen added a comment -

            fixed on v1.29

            chenc Chen Cohen added a comment - fixed on v1.29

            Code changed in jenkins
            User: Chen Cohen
            Path:
            Jenkinsfile
            pom.xml
            src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuild.java
            src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobProject.java
            src/main/java/com/tikal/jenkins/plugins/multijob/PhaseJobsConfig.java
            src/test/java/com/tikal/jenkins/plugins/multijob/test/ConditionalPhaseTest.java
            http://jenkins-ci.org/commit/tikal-multijob-plugin/8b65c643a5dafc55537db9ae938aedcedcc5e5eb
            Log:
            Merge pull request #129 from jglick/transient-JENKINS-49328

            JENKINS-49328 Prevent inappropriate serialization of MultiJobBuild.SubBuild.build

            Compare: https://github.com/jenkinsci/tikal-multijob-plugin/compare/e70e0b75938d...8b65c643a5da

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Chen Cohen Path: Jenkinsfile pom.xml src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuild.java src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobProject.java src/main/java/com/tikal/jenkins/plugins/multijob/PhaseJobsConfig.java src/test/java/com/tikal/jenkins/plugins/multijob/test/ConditionalPhaseTest.java http://jenkins-ci.org/commit/tikal-multijob-plugin/8b65c643a5dafc55537db9ae938aedcedcc5e5eb Log: Merge pull request #129 from jglick/transient- JENKINS-49328 JENKINS-49328 Prevent inappropriate serialization of MultiJobBuild.SubBuild.build Compare: https://github.com/jenkinsci/tikal-multijob-plugin/compare/e70e0b75938d...8b65c643a5da

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuild.java
            src/test/java/com/tikal/jenkins/plugins/multijob/test/ConditionalPhaseTest.java
            http://jenkins-ci.org/commit/tikal-multijob-plugin/a1b8be0051bd54f7bfd9dfff11ebcb1ca10d2e27
            Log:
            JENKINS-49328 Prevent inappropriate serialization of MultiJobBuild.SubBuild.build.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuild.java src/test/java/com/tikal/jenkins/plugins/multijob/test/ConditionalPhaseTest.java http://jenkins-ci.org/commit/tikal-multijob-plugin/a1b8be0051bd54f7bfd9dfff11ebcb1ca10d2e27 Log: JENKINS-49328 Prevent inappropriate serialization of MultiJobBuild.SubBuild.build.
            jglick Jesse Glick added a comment -

            I am able to reproduce the JENKINS-45892 warning, though not the loading deadlock noted in JENKINS-48685, which I presume is random.

            jglick Jesse Glick added a comment - I am able to reproduce the  JENKINS-45892  warning, though not the loading deadlock noted in JENKINS-48685 , which I presume is random.

            I think this might be related to what we see in JENKINS-48685

            allan_burdajewicz Allan BURDAJEWICZ added a comment - I think this might be related to what we see in JENKINS-48685
            allan_burdajewicz Allan BURDAJEWICZ added a comment - The following field should be transient: https://github.com/jenkinsci/tikal-multijob-plugin/blob/jenkins-multijob-plugin-1.28/src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuild.java#L199

            People

              jglick Jesse Glick
              allan_burdajewicz Allan BURDAJEWICZ
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: