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

NPE from CpsStepContext.scheduleNextRun

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • workflow-cps-plugin
    • None
    • Jenkins 2.53
      workflow-cps 2.29

      After a timeout occurence, my pipeline wil leventually end with a message

      Body did not finish within grace period; terminating with extreme prejudice"
      

       Later on, build failure analyzer and lockable-resources do their work (analyzing and unlicking), github-branch-source signals the run result to github and and exception is printed:

      java.lang.NullPointerException
      	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.scheduleNextRun(CpsStepContext.java:386)
      	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.completed(CpsStepContext.java:339)
      	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.onFailure(CpsStepContext.java:328)
      	at org.jenkinsci.plugins.workflow.cps.CpsBodySubContext.onFailure(CpsBodySubContext.java:63)
      	at org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback$TailCall.onFailure(BodyExecutionCallback.java:128)
      	at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$FailureAdapter.receive(CpsBodyExecution.java:345)
      	at com.cloudbees.groovy.cps.impl.ThrowBlock$1.receive(ThrowBlock.java:68)
      	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
      	at com.cloudbees.groovy.cps.Next.step(Next.java:74)
      ...
      Finished: FAILURE
      

      The run will stop showing at the build queue (is not using a lightweight nor a normal executor), but after a Jenkins restart, it will appear again, queued waiting for an agent:

      Resuming build at Wed Apr 05 09:34:49 CEST 2017 after Jenkins restart
      Waiting to resume part of Crossdata » crossdata-spark2 » PR-5 #2: ???
      Waiting to resume part of Crossdata » crossdata-spark2 » PR-5 #2: There are no nodes with the label ...
      

      This might show that a CPSThread isnt completelly killed, and seems to be related to myself capturing the timeout exception, handling it and rethrowing. With the NPE, the execution flow hungs forever, leading to resources extarvation.

            jglick Jesse Glick
            witokondoria Javier Delgado
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: