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

NPE: Failed to abort CpsFlowExecutiontask.DurableTaskStep$Execution.stop(DurableTaskStep.java:140)

      Apr 05, 2016 10:56:52 AM org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$6 onSuccess
      WARNING: Failed to abort CpsFlowExecution[Owner[bmlltech/lux/master/2:bmlltech/lux/master #2]]
      java.lang.NullPointerException
      	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.stop(DurableTaskStep.java:140)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$6.onSuccess(CpsFlowExecution.java:760)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$6.onSuccess(CpsFlowExecution.java:755)
      	at org.jenkinsci.plugins.workflow.support.concurrent.Futures$1.run(Futures.java:150)
      	at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253)
      	at com.google.common.util.concurrent.ExecutionList$RunnableExecutorPair.execute(ExecutionList.java:149)
      	at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:134)
      	at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:170)
      	at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:53)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$5.onSuccess(CpsFlowExecution.java:644)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$5.onSuccess(CpsFlowExecution.java:631)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$4$1.run(CpsFlowExecution.java:568)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:32)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	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)
      

          [JENKINS-34021] NPE: Failed to abort CpsFlowExecutiontask.DurableTaskStep$Execution.stop(DurableTaskStep.java:140)

          Jesse Glick added a comment -

          If you are still using the doDelete hack, stop. As of JENKINS-25550 it is no longer necessary.

          Offhand it looks like DurableTaskStep.Execution.listener is null, which should not happen, and I cannot really guess why. Is there a known way to reproduce?

          Jesse Glick added a comment - If you are still using the doDelete hack, stop. As of JENKINS-25550 it is no longer necessary. Offhand it looks like DurableTaskStep.Execution.listener is null, which should not happen, and I cannot really guess why. Is there a known way to reproduce?

          Jesse Glick added a comment -

          Symptom fixed. Root cause unknown.

          Jesse Glick added a comment - Symptom fixed. Root cause unknown.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          durable-task-step/src/main/java/org/jenkinsci/plugins/workflow/steps/durable_task/DurableTaskStep.java
          http://jenkins-ci.org/commit/pipeline-plugin/344aa77547276f9ddd260868276ff0c535340bb7
          Log:
          JENKINS-34021 If DurableTaskStep.Execution.listener is sometimes null
          Backported from https://github.com/jenkinsci/workflow-durable-task-step-plugin/pull/7.

          Compare: https://github.com/jenkinsci/pipeline-plugin/compare/fe82acdc7a93...344aa7754727

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: durable-task-step/src/main/java/org/jenkinsci/plugins/workflow/steps/durable_task/DurableTaskStep.java http://jenkins-ci.org/commit/pipeline-plugin/344aa77547276f9ddd260868276ff0c535340bb7 Log: JENKINS-34021 If DurableTaskStep.Execution.listener is sometimes null Backported from https://github.com/jenkinsci/workflow-durable-task-step-plugin/pull/7 . Compare: https://github.com/jenkinsci/pipeline-plugin/compare/fe82acdc7a93...344aa7754727

          Reproducible by hard killing this:

          retry (10) {
              node { 
                  sh 'sleep 30'   
              }
          }
          

          The I see the warning message in the logs indefinitely.

          Maybe this specific case is fixed by https://github.com/jenkinsci/workflow-basic-steps-plugin/pull/35, I don't know, didn't try.

          Antonio Muñiz added a comment - Reproducible by hard killing this: retry (10) { node { sh 'sleep 30' } } The I see the warning message in the logs indefinitely. Maybe this specific case is fixed by https://github.com/jenkinsci/workflow-basic-steps-plugin/pull/35 , I don't know, didn't try.

          Ben Hines added a comment -

          We are also experiencing this error log spam, i suspect after hard killing a job too, but i wasn't able to reproduce the error log spam using Antonio's test script and /kill on the job.

          Though that was on a different instance of Jenkins with some slightly different plugin versions. Tried both 2.3 and 2.4 of basic steps.

          Ben Hines added a comment - We are also experiencing this error log spam, i suspect after hard killing a job too, but i wasn't able to reproduce the error log spam using Antonio's test script and /kill on the job. Though that was on a different instance of Jenkins with some slightly different plugin versions. Tried both 2.3 and 2.4 of basic steps.

          Jesse Glick added a comment -

          amuniz please reopen if you know exactly how to reproduce from scratch. Need to know plugin versions and exactly what you did to kill the build.

          Jesse Glick added a comment - amuniz please reopen if you know exactly how to reproduce from scratch. Need to know plugin versions and exactly what you did to kill the build.

          Antonio Muñiz added a comment - - edited
          1. Jenkins 2.32 (with all default plugins, which I think is latest versions)
          2. workflow-basic-steps-plugin didn't have the fix for retry at that time (which makes the case easier to reproduce)
          3. Create a pipeline with the script I posted before
          4. Trigger a build
          5. Click on the build stop button
          6. retry swallows the request and retries its body
          7. The halt link is printed in the console log, click on it
          8. The kill link is printed in the console log, click on it
          9. The build is killed, but a warning is continuously printed in Jenkins global log

          jglick I hope it helps.

          Antonio Muñiz added a comment - - edited Jenkins 2.32 (with all default plugins, which I think is latest versions) workflow-basic-steps-plugin didn't have the fix for retry at that time (which makes the case easier to reproduce) Create a pipeline with the script I posted before Trigger a build Click on the build stop button retry swallows the request and retries its body The halt link is printed in the console log, click on it The kill link is printed in the console log, click on it The build is killed, but a warning is continuously printed in Jenkins global log jglick I hope it helps.

          Jesse Glick added a comment -

          With 2.32.3, workflow-durable-task-step 2.9, and workflow-cps 2.29, and this script

          while (true) {
              try {
                  node {
                      sh 'sleep 30'
                  }
              } catch (e) {
                  echo "ignoring $e"
              }
          }
          

          I do get some errors, mainly

          java.io.IOException: cannot find current thread
          	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:296)
          	at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:61)
          	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.logger(DurableTaskStep.java:200)
          	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.check(DurableTaskStep.java:301)
          	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.run(DurableTaskStep.java:276)
          	at …
          

          Everything does stop cleanly and there are no recurring warnings.

          Jesse Glick added a comment - With 2.32.3, workflow-durable-task-step 2.9, and workflow-cps 2.29, and this script while ( true ) { try { node { sh 'sleep 30' } } catch (e) { echo "ignoring $e" } } I do get some errors, mainly java.io.IOException: cannot find current thread at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:296) at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:61) at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.logger(DurableTaskStep.java:200) at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.check(DurableTaskStep.java:301) at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.run(DurableTaskStep.java:276) at … Everything does stop cleanly and there are no recurring warnings.

          akostadinov added a comment -

          Seeing a lot of these in the log:

          Jul 31, 2017 3:25:52 PM WARNING org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution logger
          
          JENKINS-34021: could not get TaskListener in CpsStepContext[15:sh]:Owner[New_Puddle_Detector/192:New_Puddle_Detector #192]
          java.io.IOException: cannot find current thread
          	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:295)
          	at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:61)
          	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.logger(DurableTaskStep.java:209)
          	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.access$700(DurableTaskStep.java:139)
          	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution$3.call(DurableTaskStep.java:308)
          	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution$3.call(DurableTaskStep.java:306)
          	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution$4.call(DurableTaskStep.java:359)
          	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:748)
          
          

          Any ideas how to debug what is causing the issue?

          akostadinov added a comment - Seeing a lot of these in the log: Jul 31, 2017 3:25:52 PM WARNING org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution logger JENKINS-34021: could not get TaskListener in CpsStepContext[15:sh]:Owner[New_Puddle_Detector/192:New_Puddle_Detector #192] java.io.IOException: cannot find current thread at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:295) at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:61) at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.logger(DurableTaskStep.java:209) at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.access$700(DurableTaskStep.java:139) at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution$3.call(DurableTaskStep.java:308) at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution$3.call(DurableTaskStep.java:306) at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution$4.call(DurableTaskStep.java:359) 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:748) Any ideas how to debug what is causing the issue?

          Jesse Glick added a comment -

          akostadinov I think you are running an old version of the plugin.

          Jesse Glick added a comment - akostadinov I think you are running an old version of the plugin.

            jglick Jesse Glick
            ssbarnea Sorin Sbarnea
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: