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

Missing execution/head element causes load failure

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      We have several cases of "build.xml" that have been generated with no <head> element inside the <execution> element.

      This is causing a load failure - which prevents the job expiring.

      Load Failure

      WARNING: could not load /var/jenkins_home/jobs/<job-path>/builds/18396
      java.lang.NullPointerException
              at org.jenkinsci.plugins.workflow.cps.FlowHead.newStartNode(FlowHead.java:97)
              at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.loadProgramFailed(CpsFlowExecution.java:683)
              at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.loadProgramAsync(CpsFlowExecution.java:659)
              at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.onLoad(CpsFlowExecution.java:587)
              at org.jenkinsci.plugins.workflow.job.WorkflowRun.onLoad(WorkflowRun.java:599)
              at hudson.model.RunMap.retrieve(RunMap.java:225)
              at hudson.model.RunMap.retrieve(RunMap.java:57)
              at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:500)
              at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:482)
              at jenkins.model.lazy.AbstractLazyLoadRunMap.getByNumber(AbstractLazyLoadRunMap.java:380)
              at jenkins.model.lazy.AbstractLazyLoadRunMap.search(AbstractLazyLoadRunMap.java:331)
              at jenkins.model.lazy.LazyBuildMixIn$RunMixIn.getNextBuild(LazyBuildMixIn.java:405)
              at org.jenkinsci.plugins.workflow.job.WorkflowRun.getNextBuild(WorkflowRun.java:228)
              at org.jenkinsci.plugins.workflow.job.WorkflowRun.getNextBuild(WorkflowRun.java:129)
              at hudson.tasks.LogRotator.perform(LogRotator.java:147)
              at hudson.model.Job.logRotate(Job.java:465)
              at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:663)
              at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1400(WorkflowRun.java:131)
              at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:947)
              at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1203)
              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:745)
      

      build.xml fragment

      <?xml version='1.0' encoding='UTF-8'?>
      <flow-build plugin="workflow-job@2.10">
       <execution class="org.jenkinsci.plugins.workflow.cps.CpsFlowExecution">
          <result>SUCCESS</result>
          ... more build information ...
          <script>...
          </script>
          <loadedScripts class="map"/>
          <sandbox>true</sandbox>
          <iota>0</iota>
        </execution>
      

      Note the lack of a <head>0:23</head> or similar tag.

      Cause

      Unknown.

      I have seen this faulty XML generated with both 2.10 and 2.12 versions of the workflow-job plugin. The builds before and after the ones with faulty XML are valid.

      Impacts

      • exceptions in the log (noise, "broken windows")
      • builds can not be loaded, and thus can not be expired

        Attachments

          Activity

          Hide
          jglick Jesse Glick added a comment -

          Proposed a fix for the reported NPE. The root problem is a corrupt build record (seems heads and startNodes are empty??), so the build will not be resumable, but at least we would recover more gracefully than this: onLoad should complete.

          Show
          jglick Jesse Glick added a comment - Proposed a fix for the reported NPE. The root problem is a corrupt build record (seems heads and startNodes are empty??), so the build will not be resumable, but at least we would recover more gracefully than this: onLoad should complete.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
          http://jenkins-ci.org/commit/workflow-job-plugin/60c5bc59c11505c9cd743f8eed375fe974acd4f0
          Log:
          JENKINS-44548 Extend robustness fix to any runtime exception from FlowExecution.onLoad.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java http://jenkins-ci.org/commit/workflow-job-plugin/60c5bc59c11505c9cd743f8eed375fe974acd4f0 Log: JENKINS-44548 Extend robustness fix to any runtime exception from FlowExecution.onLoad.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Sam Van Oort
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
          http://jenkins-ci.org/commit/workflow-job-plugin/58a884d74a9da56b2253e379ef256f411dfc262a
          Log:
          Merge pull request #59 from jglick/NPE-JENKINS-44548

          JENKINS-44548 Extend robustness fix to any runtime exception from FlowExecution.onLoad

          Compare: https://github.com/jenkinsci/workflow-job-plugin/compare/bbec76226dcb...58a884d74a9d

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Van Oort Path: src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java http://jenkins-ci.org/commit/workflow-job-plugin/58a884d74a9da56b2253e379ef256f411dfc262a Log: Merge pull request #59 from jglick/NPE- JENKINS-44548 JENKINS-44548 Extend robustness fix to any runtime exception from FlowExecution.onLoad Compare: https://github.com/jenkinsci/workflow-job-plugin/compare/bbec76226dcb...58a884d74a9d
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/cps/FlowHead.java
          http://jenkins-ci.org/commit/workflow-cps-plugin/fc4c453485b7846579e930ed6e83c8346664a6df
          Log:
          JENKINS-44548 NPE from loadProgramFailed.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/cps/FlowHead.java http://jenkins-ci.org/commit/workflow-cps-plugin/fc4c453485b7846579e930ed6e83c8346664a6df Log: JENKINS-44548 NPE from loadProgramFailed.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Sam Van Oort
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/cps/FlowHead.java
          http://jenkins-ci.org/commit/workflow-cps-plugin/7d85ae758f1589b73c5b595aa95610f8369c4612
          Log:
          Merge pull request #158 from jglick/NPE-JENKINS-44548

          JENKINS-44548 NPE from loadProgramFailed

          Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/bc0a76812d2d...7d85ae758f15

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Van Oort Path: src/main/java/org/jenkinsci/plugins/workflow/cps/FlowHead.java http://jenkins-ci.org/commit/workflow-cps-plugin/7d85ae758f1589b73c5b595aa95610f8369c4612 Log: Merge pull request #158 from jglick/NPE- JENKINS-44548 JENKINS-44548 NPE from loadProgramFailed Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/bc0a76812d2d...7d85ae758f15

            People

            • Assignee:
              jglick Jesse Glick
              Reporter:
              bwalding Ben Walding
            • Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: