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

FutureImpl.cancel() doesn't cancel the linked job

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None
    • core 1.648

      FutureImpl.cancel() doesn't cancel the job linked to the Future object, as executor set is always empty. It's supposed to be filled in WorkUnitContext.createWorkUnit() but it's not executed on the Executor thread, unlike the comment suggests:

          public WorkUnit createWorkUnit(SubTask execUnit) {
              Executor executor = Executor.currentExecutor();
              if (executor != null) { // TODO is it legal for this to be called by a non-executor thread?
                  future.addExecutor(executor);
              }
      

      This breaks build cancellation from Jenkins CLI. When a build is started with -s parameter, it's not canceled when the CLI process is interrupted. The CLI handling code in BuildCommand correctly calls FutureImpl.cancel() but nothing happens, as executor set is empty.

            Unassigned Unassigned
            ydubreuil Yoann Dubreuil
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: