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

Deleting a project does not stop all running builds

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Component/s: core
    • Labels:
    • Environment:
      Jenkins 1.642.1
      Pipeline 1.13
    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            Probably not specific to multibranch.

            Show
            jglick Jesse Glick added a comment - Probably not specific to multibranch.
            Hide
            jglick 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.

            Show
            jglick 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 .
            Hide
            jglick Jesse Glick added a comment -

            For freestyle projects, I also see an error probably caused by proceeding with the deletion without waiting for the build to finish aborting:

            … hudson.model.Run execute
            SEVERE: Failed to save build record
            java.io.IOException: Failed to create a temporary file in …/builds/1
            	at hudson.util.AtomicFileWriter.<init>(AtomicFileWriter.java:68)
            	at hudson.util.AtomicFileWriter.<init>(AtomicFileWriter.java:55)
            	at hudson.XmlFile.write(XmlFile.java:175)
            	at hudson.model.Run.save(Run.java:1901)
            	at hudson.model.Run.execute(Run.java:1798)
            	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
            	at hudson.model.ResourceController.execute(ResourceController.java:98)
            	at hudson.model.Executor.run(Executor.java:374)
            Caused by: java.io.IOException: Too many levels of symbolic links
            	at java.io.UnixFileSystem.createFileExclusively(Native Method)
            	at java.io.File.createTempFile(File.java:2024)
            	at hudson.util.AtomicFileWriter.<init>(AtomicFileWriter.java:66)
            	... 7 more
            
            Show
            jglick Jesse Glick added a comment - For freestyle projects, I also see an error probably caused by proceeding with the deletion without waiting for the build to finish aborting: … hudson.model.Run execute SEVERE: Failed to save build record java.io.IOException: Failed to create a temporary file in …/builds/1 at hudson.util.AtomicFileWriter.<init>(AtomicFileWriter.java:68) at hudson.util.AtomicFileWriter.<init>(AtomicFileWriter.java:55) at hudson.XmlFile.write(XmlFile.java:175) at hudson.model.Run.save(Run.java:1901) at hudson.model.Run.execute(Run.java:1798) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374) Caused by: java.io.IOException: Too many levels of symbolic links at java.io.UnixFileSystem.createFileExclusively(Native Method) at java.io.File.createTempFile(File.java:2024) at hudson.util.AtomicFileWriter.<init>(AtomicFileWriter.java:66) ... 7 more
            Hide
            jglick Jesse Glick added a comment -

            Should have been fixed by Stephen Connolly in JENKINS-35160.

            Show
            jglick Jesse Glick added a comment - Should have been fixed by Stephen Connolly in  JENKINS-35160 .

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: