-
Bug
-
Resolution: Unresolved
-
Minor
-
Jenkins 2.249.2
java: openjdk-1.8.0.242
Linux: RHEL 7.8
plugins:
pipeline-aws:1.42
pipeline-build-step:2.13
pipeline-config-history:1.6
pipeline-graph-analysis:1.10
pipeline-input-step:2.12
pipeline-milestone-step:1.3.1
pipeline-model-api:1.7.2
pipeline-model-definition:1.7.2
pipeline-model-extensions:1.7.2
pipeline-rest-api:2.16
pipeline-stage-step:2.5
pipeline-stage-tags-metadata:1.7.2
pipeline-stage-view:2.16
workflow-aggregator:2.6
workflow-api:2.40
workflow-basic-steps:2.22
workflow-cps-global-lib:2.17
workflow-cps:2.83
workflow-durable-task-step:2.36
workflow-job:2.40
workflow-multibranch:2.22
workflow-scm-step:2.11
workflow-step-api:2.22
workflow-support:3.5Jenkins 2.249.2 java: openjdk-1.8.0.242 Linux: RHEL 7.8 plugins: pipeline-aws:1.42 pipeline-build-step:2.13 pipeline-config-history:1.6 pipeline-graph-analysis:1.10 pipeline-input-step:2.12 pipeline-milestone-step:1.3.1 pipeline-model-api:1.7.2 pipeline-model-definition:1.7.2 pipeline-model-extensions:1.7.2 pipeline-rest-api:2.16 pipeline-stage-step:2.5 pipeline-stage-tags-metadata:1.7.2 pipeline-stage-view:2.16 workflow-aggregator:2.6 workflow-api:2.40 workflow-basic-steps:2.22 workflow-cps-global-lib:2.17 workflow-cps:2.83 workflow-durable-task-step:2.36 workflow-job:2.40 workflow-multibranch:2.22 workflow-scm-step:2.11 workflow-step-api:2.22 workflow-support:3.5
We have encountered a repeatable issue where if we execute a doSafeRestart() or safeRestart() within an imperative or declarative pipeline, Jenkins throws the following error after it restarts and tries to resume the job (even though there is nothing left to do).
Pausing (Preparing for shutdown) Resuming build at Fri Oct 23 10:00:49 EDT 2020 after Jenkins restart [Pipeline] End of Pipeline java.lang.IllegalStateException: JENKINS-50407: no loaded shell in CpsFlowExecution[Owner[restart/112:restart #112]] at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:35) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:400) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:136) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59) 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:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
In a declarative pipeline{} Jenkins then re-executes the job. I added an uptime check statement to avoid the ensuing infinite loop. Also, setting the option 'disableResume()' in the UI or in the pipeline{} did nothing to stop the re-execution.
When I moved the restart out of the pipeline{} block and into a lower node { stage {} }, the result of the job and output are identical, but Jenkins does not try to re-run the job from the beginning.
I'm attaching an example Jenkinsfile with just enough to replicate the issue, as well as the supporting library used in the Global Shared Libraries for the restart call and uptime calculation.
I've listed the relevant plugins installed with versions (at least as far as I can tell) in the environment section.