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

Stack overflow in WorkflowRun.reload after run ID migration

    Details

    • Similar Issues:

      Description

      Observed with post-1.597 cores, after run ID migration.

      hudson.model.Run.<init>(Run.java:320)
      org.jenkinsci.plugins.workflow.job.WorkflowRun.<init>(WorkflowRun.java:133)
      sun.reflect.GeneratedConstructorAccessor65.newInstance(Unknown Source)
      sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      java.lang.reflect.Constructor.newInstance(Constructor.java:408)
      jenkins.model.lazy.LazyBuildMixIn.loadBuild(LazyBuildMixIn.java:158)
      jenkins.model.lazy.LazyBuildMixIn$1.create(LazyBuildMixIn.java:135)
      hudson.model.RunMap.retrieve(RunMap.java:222)
      hudson.model.RunMap.retrieve(RunMap.java:57)
      jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:465)
      jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:448)
      jenkins.model.lazy.AbstractLazyLoadRunMap.getByNumber(AbstractLazyLoadRunMap.java:356)
      hudson.model.RunMap.getById(RunMap.java:203)
      org.jenkinsci.plugins.workflow.job.WorkflowRun$Owner.run(WorkflowRun.java:559)
      org.jenkinsci.plugins.workflow.job.WorkflowRun$Owner.getRootDir(WorkflowRun.java:588)
      org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.getStorageDir(CpsFlowExecution.java:315)
      org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.createStorage(CpsFlowExecution.java:308)
      org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.access$800(CpsFlowExecution.java:188)
      org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$ConverterImpl.unmarshal(CpsFlowExecution.java:817)
      hudson.util.XStream2$AssociatedConverterImpl.unmarshal(XStream2.java:362)
      com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
      com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
      com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
      hudson.util.RobustReflectionConverter.unmarshalField(RobustReflectionConverter.java:349)
      hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:289)
      hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:228)
      com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
      com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
      com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
      com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
      com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
      com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
      com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1189)
      hudson.util.XStream2.unmarshal(XStream2.java:113)
      com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1173)
      hudson.XmlFile.unmarshal(XmlFile.java:163)
      org.jenkinsci.plugins.workflow.job.WorkflowRun.reload(WorkflowRun.java:360)
      hudson.model.Run.<init>(Run.java:320)
      

      While it is awkward that CpsFlowExecution deserialization in turn forces the WorkflowRun candidate to be returned from Owner.run, this is normally harmless. The problem here seems to be that after RunIdMigrator has run, the WorkflowRun.id is read (via key) by reload, yet it is still null at that point because unmarshal has yet to be called, so LOADING_RUNS is inaccurate.

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            CHANGES.md
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/WorkflowRunTest.java
            aggregator/src/test/resources/org/jenkinsci/plugins/workflow/WorkflowRunTest/loadMigratedBuildRecord.zip
            job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
            http://jenkins-ci.org/commit/workflow-plugin/bdf1260dcafaf43bac23ec5d76f01916bc432e64
            Log:
            [FIXED JENKINS-27531] In 1.597+ Run.getId() is not reliable while it is still being loaded.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: CHANGES.md aggregator/src/test/java/org/jenkinsci/plugins/workflow/WorkflowRunTest.java aggregator/src/test/resources/org/jenkinsci/plugins/workflow/WorkflowRunTest/loadMigratedBuildRecord.zip job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java http://jenkins-ci.org/commit/workflow-plugin/bdf1260dcafaf43bac23ec5d76f01916bc432e64 Log: [FIXED JENKINS-27531] In 1.597+ Run.getId() is not reliable while it is still being loaded.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            CHANGES.md
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/WorkflowRunTest.java
            aggregator/src/test/resources/org/jenkinsci/plugins/workflow/WorkflowRunTest/loadMigratedBuildRecord.zip
            job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
            http://jenkins-ci.org/commit/workflow-plugin/b5617c56c3a03553cebffadcb188b788d0299869
            Log:
            Merge pull request #97 from jglick/StackOverflowError-JENKINS-27531

            JENKINS-27531 Run.id-related error in 1.597+

            Compare: https://github.com/jenkinsci/workflow-plugin/compare/f9c921341006...b5617c56c3a0

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: CHANGES.md aggregator/src/test/java/org/jenkinsci/plugins/workflow/WorkflowRunTest.java aggregator/src/test/resources/org/jenkinsci/plugins/workflow/WorkflowRunTest/loadMigratedBuildRecord.zip job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java http://jenkins-ci.org/commit/workflow-plugin/b5617c56c3a03553cebffadcb188b788d0299869 Log: Merge pull request #97 from jglick/StackOverflowError- JENKINS-27531 JENKINS-27531 Run.id-related error in 1.597+ Compare: https://github.com/jenkinsci/workflow-plugin/compare/f9c921341006...b5617c56c3a0
            Hide
            jglick Jesse Glick added a comment -

            First change in JENKINS-27704 may have made it possible to simplify this fix.

            Show
            jglick Jesse Glick added a comment - First change in JENKINS-27704 may have made it possible to simplify this fix.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
            http://jenkins-ci.org/commit/workflow-plugin/fc3851f4df8881e24c079cf51f42b48ec9596ab9
            Log:
            The fix of JENKINS-27531 in #97 seems to be made simpler by the fix of JENKINS-29571 via JENKINS-27704 in #157.
            We only needed getId(WorkflowRun) because CpsFlowExecution.unmarshal was trying to use an Owner.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java http://jenkins-ci.org/commit/workflow-plugin/fc3851f4df8881e24c079cf51f42b48ec9596ab9 Log: The fix of JENKINS-27531 in #97 seems to be made simpler by the fix of JENKINS-29571 via JENKINS-27704 in #157. We only needed getId(WorkflowRun) because CpsFlowExecution.unmarshal was trying to use an Owner.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
            http://jenkins-ci.org/commit/workflow-plugin/307f9e1cf6113b48df9480c78244ec0029c33c03
            Log:
            Merge pull request #159 from jglick/simplify-WorkflowRun

            JENKINS-27531 Simplified fix

            Compare: https://github.com/jenkinsci/workflow-plugin/compare/f6f21ae0f0bf...307f9e1cf611

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java http://jenkins-ci.org/commit/workflow-plugin/307f9e1cf6113b48df9480c78244ec0029c33c03 Log: Merge pull request #159 from jglick/simplify-WorkflowRun JENKINS-27531 Simplified fix Compare: https://github.com/jenkinsci/workflow-plugin/compare/f6f21ae0f0bf...307f9e1cf611
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/WorkflowRunTest.java
            aggregator/src/test/resources/org/jenkinsci/plugins/workflow/WorkflowRunTest/loadMigratedBuildRecord.zip
            job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
            http://jenkins-ci.org/commit/workflow-job-plugin/271382c4792341f72771cc364b4ab22129893765
            Log:
            [FIXED JENKINS-27531] In 1.597+ Run.getId() is not reliable while it is still being loaded.
            Originally-Committed-As: bdf1260dcafaf43bac23ec5d76f01916bc432e64

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/WorkflowRunTest.java aggregator/src/test/resources/org/jenkinsci/plugins/workflow/WorkflowRunTest/loadMigratedBuildRecord.zip job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java http://jenkins-ci.org/commit/workflow-job-plugin/271382c4792341f72771cc364b4ab22129893765 Log: [FIXED JENKINS-27531] In 1.597+ Run.getId() is not reliable while it is still being loaded. Originally-Committed-As: bdf1260dcafaf43bac23ec5d76f01916bc432e64
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
            http://jenkins-ci.org/commit/workflow-job-plugin/c034f77059966d1097e16a2bcc1dad2ddbe41994
            Log:
            The fix of JENKINS-27531 in #97 seems to be made simpler by the fix of JENKINS-29571 via JENKINS-27704 in #157.
            We only needed getId(WorkflowRun) because CpsFlowExecution.unmarshal was trying to use an Owner.
            Originally-Committed-As: fc3851f4df8881e24c079cf51f42b48ec9596ab9

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java http://jenkins-ci.org/commit/workflow-job-plugin/c034f77059966d1097e16a2bcc1dad2ddbe41994 Log: The fix of JENKINS-27531 in #97 seems to be made simpler by the fix of JENKINS-29571 via JENKINS-27704 in #157. We only needed getId(WorkflowRun) because CpsFlowExecution.unmarshal was trying to use an Owner. Originally-Committed-As: fc3851f4df8881e24c079cf51f42b48ec9596ab9
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
            http://jenkins-ci.org/commit/workflow-job-plugin/a593020f9a14927d687595e833905114d3509186
            Log:
            Merge pull request #159 from jglick/simplify-WorkflowRun

            JENKINS-27531 Simplified fix
            Originally-Committed-As: 307f9e1cf6113b48df9480c78244ec0029c33c03

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java http://jenkins-ci.org/commit/workflow-job-plugin/a593020f9a14927d687595e833905114d3509186 Log: Merge pull request #159 from jglick/simplify-WorkflowRun JENKINS-27531 Simplified fix Originally-Committed-As: 307f9e1cf6113b48df9480c78244ec0029c33c03

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                jglick Jesse Glick
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: