Deletion of Pipeline jobs does not wait for ongoing builds to fully complete

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      See https://github.com/jenkinsci/jenkins/pull/9790. Description reproduced here:

      While investigating an issue with branch indexing for multibranch projects leaving build directories behind when deleting projects, I think I found a rather severe issue with job deletion in general for Pipelines. Since its introduction in https://github.com/jenkinsci/jenkins/pull/2789, the logic for cancelling ongoing builds and waiting for them to complete when deleting their parent job has checked Thread.isAlive rather than Executor.isActive, which is not correct for asynchronous tasks such as the main Pipeline execution. See the Javadoc here. Oleg actually suggested changing to isActive in the original PR here for other reasons.

      The result is that although ongoing Pipeline builds are interrupted, ItemDeletion.cancelBuildsInProgress does not wait for those builds to fully complete, which can at least lead to files being written back into the job directory that was just deleted. There are probably other more exotic issues possible for Pipelines that do not shut down quickly when interrupted.

      If there are any other build types that use AsynchronousExecution, they would also be affected.

            Assignee:
            Devin Nusbaum
            Reporter:
            Devin Nusbaum
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: