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

NPE from PlaceholderTask.finish

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: pipeline
    • Labels:
    • Environment:
      Jenkins 1.628
      Workflow 1.10
    • Similar Issues:

      Description

      Parent job code:

      for(int i = 0; i < 15; i++) {
          build job: 'test_job', quietPeriod: 0, wait: false
      }
      

      Downstream job code:

      node {
       println "DOWNSTREAM JOB"
      }
      

      This results in randomly receiving the following error in the downstream jobs:

      Started by upstream project "test_parent" build number 19
      originally caused by:
       Started by user Anshu Arya
      Running: Allocate node : Start
      Running on master in /var/lib/jenkins/workspace/test_job@8
      Running: Allocate node : Body : Start
      Running: Loaded script: /jenkins_scripts/test_job.groovy
      Running: Evaluate a Groovy source file into the workflow script : Body : Start
      Running: Allocate node : Start
      Running on master in /var/lib/jenkins/workspace/test_job@2
      Running: Allocate node : Body : Start
      Running: Print Message
      DOWNSTREAM JOB
      Running: Allocate node : Body : End
      Running: Allocate node : End
      Running: Evaluate a Groovy source file into the workflow script : Body : End
      Running: Allocate node : Body : End
      Running: Allocate node : End
      Running: End of Workflow
      java.lang.NullPointerException
      	at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask.finish(ExecutorStepExecution.java:339)
      	at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask.access$400(ExecutorStepExecution.java:144)
      	at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask$Callback.finished(ExecutorStepExecution.java:370)
      	at org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback$TailCall.onSuccess(BodyExecutionCallback.java:114)
      	at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter.receive(CpsBodyExecution.java:311)
      	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:71)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:106)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:79)
      	at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
      	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
      	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:145)
      	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:271)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:71)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:180)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:178)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
      	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)
      Finished: FAILURE
      

      I had originally mentioned this here https://goo.gl/fHwwUQ but I narrowed it down to this small code example which exhibits the error.

        Attachments

          Issue Links

            Activity

            Hide
            anshuarya Anshu Arya added a comment -

            Renamed the bug from "NPE from PlaceholderTask.finish when running many concurrent builds" to just "NPE from PlaceholderTask.finish". It is easier to re-create with many concurrent builds, because it is random, but I have observed it with just a single build as well.

            Show
            anshuarya Anshu Arya added a comment - Renamed the bug from "NPE from PlaceholderTask.finish when running many concurrent builds" to just "NPE from PlaceholderTask.finish". It is easier to re-create with many concurrent builds, because it is random, but I have observed it with just a single build as well.
            Hide
            jglick Jesse Glick added a comment -

            I sometimes see what I think is a related bug:

            java.lang.NullPointerException
            	at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask$PlaceholderExecutable.run(ExecutorStepExecution.java:485)
            	at hudson.model.ResourceController.execute(ResourceController.java:98)
            	at hudson.model.Executor.run(Executor.java:381)
            
            Show
            jglick Jesse Glick added a comment - I sometimes see what I think is a related bug: java.lang.NullPointerException at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask$PlaceholderExecutable.run(ExecutorStepExecution.java:485) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:381)
            Hide
            jglick Jesse Glick added a comment -

            Or correspondingly from a test:

            === Starting restarted(org.jenkinsci.plugins.workflow.steps.TimeoutStepTest)
            Unblocking restarted/1 as success
            [restarted #1] Resuming build
            [restarted #1] [Pipeline] } //timeout
            [restarted #1] [Pipeline] Enforce time limit : End
            … hudson.model.Executor finish1
            SEVERE: Executor threw an exception
            java.lang.AssertionError: no entry for … among []
            	at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask$PlaceholderExecutable.run(ExecutorStepExecution.java:481)
            	at hudson.model.ResourceController.execute(ResourceController.java:98)
            	at hudson.model.Executor.run(Executor.java:381)
            
            Show
            jglick Jesse Glick added a comment - Or correspondingly from a test: === Starting restarted(org.jenkinsci.plugins.workflow.steps.TimeoutStepTest) Unblocking restarted/1 as success [restarted #1] Resuming build [restarted #1] [Pipeline] } //timeout [restarted #1] [Pipeline] Enforce time limit : End … hudson.model.Executor finish1 SEVERE: Executor threw an exception java.lang.AssertionError: no entry for … among [] at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask$PlaceholderExecutable.run(ExecutorStepExecution.java:481) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:381)
            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/steps/ExecutorStepTest.java
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java
            http://jenkins-ci.org/commit/workflow-plugin/e0fe19d80ad3478780d8f4246f63d398358e7437
            Log:
            [FIXED JENKINS-30759] Race condition initializing fields in RunningTask.

            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/steps/ExecutorStepTest.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java http://jenkins-ci.org/commit/workflow-plugin/e0fe19d80ad3478780d8f4246f63d398358e7437 Log: [FIXED JENKINS-30759] Race condition initializing fields in RunningTask.
            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/steps/ExecutorStepTest.java
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java
            http://jenkins-ci.org/commit/workflow-plugin/10b3bc8154c156a08b1eb5ad3f60d79eae8902bc
            Log:
            Merge pull request #323 from jglick/quick-node-JENKINS-30759

            JENKINS-30759 Race condition initializing fields in RunningTask

            Compare: https://github.com/jenkinsci/workflow-plugin/compare/0bf6742cd3b8...10b3bc8154c1

            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/steps/ExecutorStepTest.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java http://jenkins-ci.org/commit/workflow-plugin/10b3bc8154c156a08b1eb5ad3f60d79eae8902bc Log: Merge pull request #323 from jglick/quick-node- JENKINS-30759 JENKINS-30759 Race condition initializing fields in RunningTask Compare: https://github.com/jenkinsci/workflow-plugin/compare/0bf6742cd3b8...10b3bc8154c1

              People

              Assignee:
              jglick Jesse Glick
              Reporter:
              anshuarya Anshu Arya
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: