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

Deleting a project does not stop all running builds

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • core
    • Jenkins 1.642.1
      Pipeline 1.13

      Current behaviour:
      1. A Multibranch Pipeline project is running a build.
      2. Delete that project.
      3. Builds, flyweight and heavyweight, are still running
      4. Attempting to stop the builds manually, by clicking the stop icon in the 'Build executor status', results in no visible effect.

      Expected behaviour:
      1. A Multibranch Pipeline project is running a build.
      2. Delete that project.
      3. Builds, flyweight and heavyweight, have been stopped.

          [JENKINS-32783] Deleting a project does not stop all running builds

          Zach Norris created issue -
          Zach Norris made changes -
          Summary Original: Removing a Multibranch Pipeline project does not stop its running jobs New: Removing a Multibranch Pipeline project does not stop its running build
          Zach Norris made changes -
          Description Original: Current behaviour:
          1. A Multibranch Pipeline project is running a job.
          2. Delete that project.
          3. Jobs, flyweight and heavyweight, are still running

          Expected behaviour:
          1. A Multibranch Pipeline project is running a job.
          2. Delete that project.
          3. Jobs, flyweight and heavyweight, have been stopped.
          New: Current behaviour:
          1. A Multibranch Pipeline project is running a buld.
          2. Delete that project.
          3. Builds, flyweight and heavyweight, are still running

          Expected behaviour:
          1. A Multibranch Pipeline project is running a build.
          2. Delete that project.
          3. Builds, flyweight and heavyweight, have been stopped.
          Zach Norris made changes -
          Description Original: Current behaviour:
          1. A Multibranch Pipeline project is running a buld.
          2. Delete that project.
          3. Builds, flyweight and heavyweight, are still running

          Expected behaviour:
          1. A Multibranch Pipeline project is running a build.
          2. Delete that project.
          3. Builds, flyweight and heavyweight, have been stopped.
          New: Current behaviour:
          1. A Multibranch Pipeline project is running a buld.
          2. Delete that project.
          3. Builds, flyweight and heavyweight, are still running
          4. Attempting to stop the builds manually

          Expected behaviour:
          1. A Multibranch Pipeline project is running a build.
          2. Delete that project.
          3. Builds, flyweight and heavyweight, have been stopped.
          Zach Norris made changes -
          Description Original: Current behaviour:
          1. A Multibranch Pipeline project is running a buld.
          2. Delete that project.
          3. Builds, flyweight and heavyweight, are still running
          4. Attempting to stop the builds manually

          Expected behaviour:
          1. A Multibranch Pipeline project is running a build.
          2. Delete that project.
          3. Builds, flyweight and heavyweight, have been stopped.
          New: Current behaviour:
          1. A Multibranch Pipeline project is running a buld.
          2. Delete that project.
          3. Builds, flyweight and heavyweight, are still running
          4. Attempting to stop the builds manually, by clicking the stop icon in the 'Build executor status', results in no visible effect.

          Expected behaviour:
          1. A Multibranch Pipeline project is running a build.
          2. Delete that project.
          3. Builds, flyweight and heavyweight, have been stopped.

          Jesse Glick added a comment -

          Probably not specific to multibranch.

          Jesse Glick added a comment - Probably not specific to multibranch.
          Jesse Glick made changes -
          Summary Original: Removing a Multibranch Pipeline project does not stop its running build New: Deleting a Pipeline project does not stop its running build
          Zach Norris made changes -
          Description Original: Current behaviour:
          1. A Multibranch Pipeline project is running a buld.
          2. Delete that project.
          3. Builds, flyweight and heavyweight, are still running
          4. Attempting to stop the builds manually, by clicking the stop icon in the 'Build executor status', results in no visible effect.

          Expected behaviour:
          1. A Multibranch Pipeline project is running a build.
          2. Delete that project.
          3. Builds, flyweight and heavyweight, have been stopped.
          New: Current behaviour:
          1. A Multibranch Pipeline project is running a build.
          2. Delete that project.
          3. Builds, flyweight and heavyweight, are still running
          4. Attempting to stop the builds manually, by clicking the stop icon in the 'Build executor status', results in no visible effect.

          Expected behaviour:
          1. A Multibranch Pipeline project is running a build.
          2. Delete that project.
          3. Builds, flyweight and heavyweight, have been stopped.

          Jesse Glick added a comment -

          Actually not even specific to Pipeline.

          This code gets run when you delete any job. And it will delete the latest build if it is running:

          org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
          	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.interrupt(CpsFlowExecution.java:752)
          	at org.jenkinsci.plugins.workflow.job.WorkflowRun$2.interrupt(WorkflowRun.java:230)
          	at hudson.model.Executor.interrupt(Executor.java:227)
          	at hudson.model.Executor.interrupt(Executor.java:197)
          	at hudson.model.Executor.interrupt(Executor.java:187)
          	at hudson.model.Executor.interrupt(Executor.java:173)
          	at hudson.model.Job.performDelete(Job.java:274)
          	at org.jenkinsci.plugins.workflow.job.WorkflowJob.performDelete(WorkflowJob.java:580)
          	at hudson.model.AbstractItem.delete(AbstractItem.java:581)
          	at hudson.model.Job.delete(Job.java:687)
          	at hudson.model.AbstractItem.doDoDelete(AbstractItem.java:542)
          …
          org.jenkinsci.plugins.workflow.job.WorkflowRun finish
          INFO: somejob #2 completed: ABORTED
          

          But if the job is set to be concurrent-capable (freestyle projects are not by default, Pipeline projects are by default), and you in fact have multiple builds running, the earlier running builds will stay in the system, potentially causing mayhem.

          Probably the implementation should also wait for, say, 10s for the build to actually finish aborting before proceeding.

          There is one additional detail that freestyle projects do which Pipeline currently does not: prevent new builds from being scheduled.

          Jesse Glick added a comment - Actually not even specific to Pipeline. This code gets run when you delete any job. And it will delete the latest build if it is running: org.jenkinsci.plugins.workflow.steps.FlowInterruptedException at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.interrupt(CpsFlowExecution.java:752) at org.jenkinsci.plugins.workflow.job.WorkflowRun$2.interrupt(WorkflowRun.java:230) at hudson.model.Executor.interrupt(Executor.java:227) at hudson.model.Executor.interrupt(Executor.java:197) at hudson.model.Executor.interrupt(Executor.java:187) at hudson.model.Executor.interrupt(Executor.java:173) at hudson.model.Job.performDelete(Job.java:274) at org.jenkinsci.plugins.workflow.job.WorkflowJob.performDelete(WorkflowJob.java:580) at hudson.model.AbstractItem.delete(AbstractItem.java:581) at hudson.model.Job.delete(Job.java:687) at hudson.model.AbstractItem.doDoDelete(AbstractItem.java:542) … org.jenkinsci.plugins.workflow.job.WorkflowRun finish INFO: somejob #2 completed: ABORTED But if the job is set to be concurrent-capable (freestyle projects are not by default, Pipeline projects are by default), and you in fact have multiple builds running, the earlier running builds will stay in the system, potentially causing mayhem. Probably the implementation should also wait for, say, 10s for the build to actually finish aborting before proceeding. There is one additional detail that freestyle projects do which Pipeline currently does not: prevent new builds from being scheduled .
          Jesse Glick made changes -
          Component/s New: core [ 15593 ]
          Component/s Original: workflow-plugin [ 18820 ]
          Assignee Original: Jesse Glick [ jglick ]
          Labels New: workflow
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          Summary Original: Deleting a Pipeline project does not stop its running build New: Deleting a project does not stop all running builds

            Unassigned Unassigned
            znorris Zach Norris
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: