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

Way to mark an Executable that should not block isReadyToRestart

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Major Major
    • core

      If you have a Queue.Executable that should consume an executor (so is not from a FlyweightTask), it unconditionally blocks "safe restart": RestartListener.Default merely checks for the existence of at least one busy executor. For an executable using the durable-task plugin or similar, this is undesirable, since the task can in fact survive a Jenkins restart. There should be a way to mark an Executable (or its parent Task) as not blocking restart.

      There is already NonBlockingTask but this controls whether the task can be scheduled while Jenkins is quieting down, while this issue pertains to tasks which are already running and are safe to interrupt.

      As an aside, Jenkins.doSafeExit inexplicably has its own copy of safe shutdown code which neglects to use doQuietDown(true, 0) like doSafeRestart does, and thus does not consider RestartListener.

          [JENKINS-22941] Way to mark an Executable that should not block isReadyToRestart

          Jesse Glick added a comment -

          Also would like an API allowing the flyweight WorkflowRun executable to block a restart while in the middle of a CPS native method. This is especially important for a potentially slow operation like ArtifactArchiver.perform which cannot be stopped partway through. When Jenkins goes into quiet mode, new CPS-transformed calls should not start (so the program counter should pause), and any native methods currently running should be allowed to run to completion before shutdown occurs. This API could be very similar to the one above; essentially a way of customizing the logic of what constitutes a “running executable”.

          Jesse Glick added a comment - Also would like an API allowing the flyweight WorkflowRun executable to block a restart while in the middle of a CPS native method. This is especially important for a potentially slow operation like ArtifactArchiver.perform which cannot be stopped partway through. When Jenkins goes into quiet mode, new CPS-transformed calls should not start (so the program counter should pause), and any native methods currently running should be allowed to run to completion before shutdown occurs. This API could be very similar to the one above; essentially a way of customizing the logic of what constitutes a “running executable”.

          Jesse Glick added a comment -

          JENKINS-25938 also requires an API extension to Executable.

          Jesse Glick added a comment - JENKINS-25938 also requires an API extension to Executable .

          Code changed in jenkins
          User: Jesse Glick
          Path:
          core/src/main/java/hudson/model/Executor.java
          core/src/main/java/hudson/model/RestartListener.java
          core/src/main/java/jenkins/model/Jenkins.java
          core/src/main/java/jenkins/model/queue/AsynchronousExecution.java
          http://jenkins-ci.org/commit/jenkins/8589b211f9a99fa47d022a77bd7936636175898a
          Log:
          [FIXED JENKINS-22941] AsynchronousExecution.blocksRestart

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/model/Executor.java core/src/main/java/hudson/model/RestartListener.java core/src/main/java/jenkins/model/Jenkins.java core/src/main/java/jenkins/model/queue/AsynchronousExecution.java http://jenkins-ci.org/commit/jenkins/8589b211f9a99fa47d022a77bd7936636175898a Log: [FIXED JENKINS-22941] AsynchronousExecution.blocksRestart

          dogfood added a comment -

          Integrated in jenkins_main_trunk #4029
          [FIXED JENKINS-22941] AsynchronousExecution.blocksRestart (Revision 8589b211f9a99fa47d022a77bd7936636175898a)

          Result = SUCCESS
          jesse glick : 8589b211f9a99fa47d022a77bd7936636175898a
          Files :

          • core/src/main/java/hudson/model/Executor.java
          • core/src/main/java/jenkins/model/Jenkins.java
          • core/src/main/java/hudson/model/RestartListener.java
          • core/src/main/java/jenkins/model/queue/AsynchronousExecution.java

          dogfood added a comment - Integrated in jenkins_main_trunk #4029 [FIXED JENKINS-22941] AsynchronousExecution.blocksRestart (Revision 8589b211f9a99fa47d022a77bd7936636175898a) Result = SUCCESS jesse glick : 8589b211f9a99fa47d022a77bd7936636175898a Files : core/src/main/java/hudson/model/Executor.java core/src/main/java/jenkins/model/Jenkins.java core/src/main/java/hudson/model/RestartListener.java core/src/main/java/jenkins/model/queue/AsynchronousExecution.java

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: changelog.html http://jenkins-ci.org/commit/jenkins/46dc6850edb1d7ef52592794b15e69db7dfbed1a Log: Noting merges JENKINS-15355 JENKINS-21618 JENKINS-22941 JENKINS-25938 JENKINS-26391 JENKINS-26900 JENKINS-27476 JENKINS-27563 JENKINS-27564 JENKINS-27565 JENKINS-27566 Fixing link text for JENKINS-6167

          Code changed in jenkins
          User: Jesse Glick
          Path:
          job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
          support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java
          http://jenkins-ci.org/commit/workflow-plugin/285b4501470f321086bcca4f98c871f2d5b6d418
          Log:
          JENKINS-22941 AsynchronousExecution.blocksRestart

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java http://jenkins-ci.org/commit/workflow-plugin/285b4501470f321086bcca4f98c871f2d5b6d418 Log: JENKINS-22941 AsynchronousExecution.blocksRestart

          Code changed in jenkins
          User: Jesse Glick
          Path:
          job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
          http://jenkins-ci.org/commit/workflow-job-plugin/40d1c43a2fbe7f76745ed53b6a73539c64d6cedd
          Log:
          JENKINS-22941 AsynchronousExecution.blocksRestart
          Originally-Committed-As: 285b4501470f321086bcca4f98c871f2d5b6d418

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java http://jenkins-ci.org/commit/workflow-job-plugin/40d1c43a2fbe7f76745ed53b6a73539c64d6cedd Log: JENKINS-22941 AsynchronousExecution.blocksRestart Originally-Committed-As: 285b4501470f321086bcca4f98c871f2d5b6d418

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: