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

Executor_Number variable doesn't align with the “build executor status”

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: core
    • Labels:
      None
    • Similar Issues:

      Description

      After cancelling a build on an agent, the EXECUTOR_NUMBER variable gets out of sync with the "build executor status" number.

      Please check attached screenshots.

        Attachments

        1. BuildExecutorStatus.png
          BuildExecutorStatus.png
          333 kB
        2. Freestyle1Job.png
          Freestyle1Job.png
          194 kB
        3. Freestyle2Job.png
          Freestyle2Job.png
          194 kB
        4. Freestyle3Job.png
          Freestyle3Job.png
          194 kB

          Activity

          Hide
          danielbeck Daniel Beck added a comment -

          Executors are 0-indexed internally (and this is passed to the job), and 1-indexed on the UI. (In fact, you can have much higher internal executor indexes after increasing and then decreasing executor count and it'll not show up on the UI as to not confuse users.) So this isn't actually a bug from my POV. What exactly is affected by this?

          Show
          danielbeck Daniel Beck added a comment - Executors are 0-indexed internally (and this is passed to the job), and 1-indexed on the UI. (In fact, you can have much higher internal executor indexes after increasing and then decreasing executor count and it'll not show up on the UI as to not confuse users.) So this isn't actually a bug from my POV. What exactly is affected by this?
          Hide
          timothy_duch Timothy Duch added a comment -

          From what I can see, this is still happening, and I consider it a bug (from the perspective of the documentation: https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project) "This is the number you see in the "build executor status", except that the number starts from 0, not 1".

          You can see in the images above that Build #7 has EXECUTOR_NUMBER 0, whilst on the UI under the build executor status, build #7 is running on what I would expect to be EXECUTOR_NUMBER 1 (#2 - 1 = 1).

          Show
          timothy_duch Timothy Duch added a comment - From what I can see, this is still happening, and I consider it a bug (from the perspective of the documentation: https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project ) "This is the number you see in the "build executor status", except that the number starts from 0, not 1". You can see in the images above that Build #7 has EXECUTOR_NUMBER 0, whilst on the UI under the build executor status, build #7 is running on what I would expect to be EXECUTOR_NUMBER 1 (#2 - 1 = 1).
          Hide
          roebi Robert Halter added a comment - - edited

          The Problem ist here
          https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Computer.java#L1045
          in removeExecutor(Executor e): executors.remove(e);
          This remove a Executor in CopyOnWriteArrayList<Executor> executors
          https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Computer.java#L151
          in Combination with
          https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Computer.java#L1046
          addNewExecutorIfNecessary();
          This add a new Executor with the same Number like the removed, but add it at the End of the List:
          https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Computer.java#L904
          executors.add(e);

          Possible Solution
          In End of Method addNewExecutorIfNecessary() a Sort in executors List sorted by the Executor Numbers.

          Show
          roebi Robert Halter added a comment - - edited The Problem ist here https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Computer.java#L1045 in removeExecutor(Executor e): executors.remove(e); This remove a Executor in CopyOnWriteArrayList<Executor> executors https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Computer.java#L151 in Combination with https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Computer.java#L1046 addNewExecutorIfNecessary(); This add a new Executor with the same Number like the removed, but add it at the End of the List: https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Computer.java#L904 executors.add(e); Possible Solution In End of Method addNewExecutorIfNecessary() a Sort in executors List sorted by the Executor Numbers.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            fadelw Fadel Wanssa
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: