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

Using withFolderProperties in a pipeline job makes runs unable to resume

XMLWordPrintable

      Our pipeline-based runs have been unable to resume, and Jenkins used to emit a rather opaque stack trace:

      10:42:40  org.jenkinsci.plugins.workflow.steps.SynchronousResumeNotSupportedException: Resume after a restart not supported for non-blocking synchronous steps
      10:42:40  	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution.onResume(AbstractSynchronousNonBlockingStepExecution.java:70)
      10:42:40  	at org.jenkinsci.plugins.workflow.flow.FlowExecutionList$ParallelResumer.lambda$run$5(FlowExecutionList.java:378)
      10:42:40  	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:30)
      10:42:40  	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:70)
      10:42:40  	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      10:42:40  	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      10:42:40  	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      10:42:40  	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      10:42:40  	at java.base/java.lang.Thread.run(Thread.java:829)
      10:42:40  Finished: ABORTED
      

      Thanks to more recent versions of Jenkins surfacing a more detailed error message, I discovered that it is the use of the withFolderProperties step that is the (first?) reason our runs cannot be resumed:

      11:07:08  org.jenkinsci.plugins.workflow.steps.SynchronousResumeNotSupportedException: The Pipeline step `withFolderProperties` cannot be resumed after a controller restart. In Scripted syntax, you may wrap its containing `node` block within `retry(conditions: [nonresumable()], count: 2) {...}`, or, in Declarative syntax, use the `retries` option to an `agent` directive to allow the stage to be retried.
      11:07:08  	at PluginClassLoader for workflow-step-api//org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.onResume(SynchronousNonBlockingStepExecution.java:78)
      11:07:08  	at PluginClassLoader for workflow-api//org.jenkinsci.plugins.workflow.flow.FlowExecutionList$ParallelResumer.lambda$run$6(FlowExecutionList.java:478)
      11:07:08  	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      11:07:08  	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
      11:07:08  	at jenkins.util.ErrorLoggingExecutorService.lambda$wrap$0(ErrorLoggingExecutorService.java:51)
      11:07:08  	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
      11:07:08  	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
      11:07:08  	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
      11:07:08  	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
      11:07:08  	at java.base/java.lang.Thread.run(Thread.java:1583)
      

      Indeed, line 36 of src/main/java/com/mig82/folders/step/FolderPropertiesStep.java at master in jenkinsci/folder-properties-plugin shows us:

          private static class Execution extends SynchronousNonBlockingStepExecution<Void> {
      

      I don't write Jenkins plugins often enough to know what a better class to use here would be, but it would be nice to have long runs (we have simulations that can run for days) resume gracefully after a controller restart.

            mig82 Miguelángel Fernández
            oli Olivier Dagenais
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: