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

Throttle concurrent builds and lockable resource do not work with block on upstream

      Setup

      Set Jenkins to have one node (master), and two executors.
      Create a throttle category my-category with global max 1.

      Create freestyle project A.
      Build step `sleep 10`.

      Create freestyle project B.
      Throttle on my-category.
      Build step `sleep 10`.

      Create freestyle project C.
      Throttle on my-category.
      Build step `sleep 10`.
      Post-build, trigger downstream project D.

      Create freestyle project D.
      Block on upstream jobs.
      Build step `sleep 10`.

      Trigger A, B, C, and D, in that order.

      Expected

      A starts.
      B starts.
      A finishes.
      B finishes.
      C starts.
      C finishes.
      D starts.
      D finishes.

      Actual

      A starts.
      B starts.
      A finishes.
      D starts.
      B finishes.
      C starts.
      D finishes.
      C finishes.

      D does not wait on C.

      I also tried lockable resource plugin with the same setup, but it didn't work either.

      I do not know of any workaround.

          [JENKINS-27968] Throttle concurrent builds and lockable resource do not work with block on upstream

          Paul Draper created issue -
          Paul Draper made changes -
          Description Original: Setup:

          Set Jenkins to have one node (master), and two executors.
          Create a throttle category my-category with global max 1.

          Create freestyle project A.
          Build step `sleep 5`.

          Create freestyle project B.
          Throttle on my-category.
          Build step `sleep 10`.

          Create freestyle project C.
          Throttle on my-category.
          Build step `sleep 10`.
          Trigger downstream project D.

          Create freestyle project D.
          Block on upstream jobs.
          Build step `sleep 10`.

          Trigger A, B, C, and D, in that order.

          ---

          What I expected:

          A and B start.
          A finishes.
          B finishes.
          C starts.
          C finishes.
          D starts.
          D finishes.

          ---

          What happened:

          A and B start.
          A finishes.
          D starts.
          B finishes.
          C starts.
          D finishes.
          C finishes.

          D does not wait on C.

          ---

          I also tried lockable resource plugin with the same setup, but it didn't work either.
          New: Setup:

          Set Jenkins to have one node (master), and two executors.
          Create a throttle category my-category with global max 1.

          Create freestyle project A.
          Build step `sleep 5`.

          Create freestyle project B.
          Throttle on my-category.
          Build step `sleep 10`.

          Create freestyle project C.
          Throttle on my-category.
          Build step `sleep 10`.
          Trigger downstream project D.

          Create freestyle project D.
          Block on upstream jobs.
          Build step `sleep 10`.

          Trigger A, B, C, and D, in that order.

          ---

          What I expected:

          A starts.
          B starts.
          A finishes.
          B finishes.
          C starts.
          C finishes.
          D starts.
          D finishes.

          ---

          What happened:

          A starts.
          B starts.
          A finishes.
          D starts.
          B finishes.
          C starts.
          D finishes.
          C finishes.

          D does not wait on C.

          ---

          I also tried lockable resource plugin with the same setup, but it didn't work either.
          Paul Draper made changes -
          Description Original: Setup:

          Set Jenkins to have one node (master), and two executors.
          Create a throttle category my-category with global max 1.

          Create freestyle project A.
          Build step `sleep 5`.

          Create freestyle project B.
          Throttle on my-category.
          Build step `sleep 10`.

          Create freestyle project C.
          Throttle on my-category.
          Build step `sleep 10`.
          Trigger downstream project D.

          Create freestyle project D.
          Block on upstream jobs.
          Build step `sleep 10`.

          Trigger A, B, C, and D, in that order.

          ---

          What I expected:

          A starts.
          B starts.
          A finishes.
          B finishes.
          C starts.
          C finishes.
          D starts.
          D finishes.

          ---

          What happened:

          A starts.
          B starts.
          A finishes.
          D starts.
          B finishes.
          C starts.
          D finishes.
          C finishes.

          D does not wait on C.

          ---

          I also tried lockable resource plugin with the same setup, but it didn't work either.
          New: *Setup*

          Set Jenkins to have one node (master), and two executors.
          Create a throttle category my-category with global max 1.

          Create freestyle project A.
          Build step `sleep 5`.

          Create freestyle project B.
          Throttle on my-category.
          Build step `sleep 10`.

          Create freestyle project C.
          Throttle on my-category.
          Build step `sleep 10`.
          Trigger downstream project D.

          Create freestyle project D.
          Block on upstream jobs.
          Build step `sleep 10`.

          Trigger A, B, C, and D, in that order.

          ---

          *Expected*

          A starts.
          B starts.
          A finishes.
          B finishes.
          C starts.
          C finishes.
          D starts.
          D finishes.

          ---

          *Actual*

          A starts.
          B starts.
          A finishes.
          **D starts.**
          B finishes.
          **C starts.**
          D finishes.
          C finishes.

          D does not wait on C.

          ---

          I also tried lockable resource plugin with the same setup, but it didn't work either.
          Paul Draper made changes -
          Description Original: *Setup*

          Set Jenkins to have one node (master), and two executors.
          Create a throttle category my-category with global max 1.

          Create freestyle project A.
          Build step `sleep 5`.

          Create freestyle project B.
          Throttle on my-category.
          Build step `sleep 10`.

          Create freestyle project C.
          Throttle on my-category.
          Build step `sleep 10`.
          Trigger downstream project D.

          Create freestyle project D.
          Block on upstream jobs.
          Build step `sleep 10`.

          Trigger A, B, C, and D, in that order.

          ---

          *Expected*

          A starts.
          B starts.
          A finishes.
          B finishes.
          C starts.
          C finishes.
          D starts.
          D finishes.

          ---

          *Actual*

          A starts.
          B starts.
          A finishes.
          **D starts.**
          B finishes.
          **C starts.**
          D finishes.
          C finishes.

          D does not wait on C.

          ---

          I also tried lockable resource plugin with the same setup, but it didn't work either.
          New: *Setup*

          Set Jenkins to have one node (master), and two executors.
          Create a throttle category my-category with global max 1.

          Create freestyle project A.
          Build step `sleep 5`.

          Create freestyle project B.
          Throttle on my-category.
          Build step `sleep 10`.

          Create freestyle project C.
          Throttle on my-category.
          Build step `sleep 10`.
          Trigger downstream project D.

          Create freestyle project D.
          Block on upstream jobs.
          Build step `sleep 10`.

          Trigger A, B, C, and D, in that order.

          ---

          *Expected*

          A starts.
          B starts.
          A finishes.
          B finishes.
          C starts.
          C finishes.
          D starts.
          D finishes.

          ---

          *Actual*

          A starts.
          B starts.
          A finishes.
          _D starts._
          B finishes.
          _C starts._
          D finishes.
          C finishes.

          D does not wait on C.

          ---

          I also tried lockable resource plugin with the same setup, but it didn't work either.
          Paul Draper made changes -
          Description Original: *Setup*

          Set Jenkins to have one node (master), and two executors.
          Create a throttle category my-category with global max 1.

          Create freestyle project A.
          Build step `sleep 5`.

          Create freestyle project B.
          Throttle on my-category.
          Build step `sleep 10`.

          Create freestyle project C.
          Throttle on my-category.
          Build step `sleep 10`.
          Trigger downstream project D.

          Create freestyle project D.
          Block on upstream jobs.
          Build step `sleep 10`.

          Trigger A, B, C, and D, in that order.

          ---

          *Expected*

          A starts.
          B starts.
          A finishes.
          B finishes.
          C starts.
          C finishes.
          D starts.
          D finishes.

          ---

          *Actual*

          A starts.
          B starts.
          A finishes.
          _D starts._
          B finishes.
          _C starts._
          D finishes.
          C finishes.

          D does not wait on C.

          ---

          I also tried lockable resource plugin with the same setup, but it didn't work either.
          New: *Setup*

          Set Jenkins to have one node (master), and two executors.
          Create a throttle category my-category with global max 1.

          Create freestyle project A.
          Build step `sleep 5`.

          Create freestyle project B.
          Throttle on my-category.
          Build step `sleep 10`.

          Create freestyle project C.
          Throttle on my-category.
          Build step `sleep 10`.
          Trigger downstream project D.

          Create freestyle project D.
          Block on upstream jobs.
          Build step `sleep 10`.

          Trigger A, B, C, and D, in that order.

          ---

          *Expected*

          A starts.
          B starts.
          A finishes.
          B finishes.
          C starts.
          C finishes.
          D starts.
          D finishes.

          ---

          *Actual*

          A starts.
          B starts.
          A finishes.
          *_D starts._*
          B finishes.
          *_C starts._*
          D finishes.
          C finishes.

          D does not wait on C.

          ---

          I also tried lockable resource plugin with the same setup, but it didn't work either.
          Paul Draper made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          Paul Draper made changes -
          Description Original: *Setup*

          Set Jenkins to have one node (master), and two executors.
          Create a throttle category my-category with global max 1.

          Create freestyle project A.
          Build step `sleep 5`.

          Create freestyle project B.
          Throttle on my-category.
          Build step `sleep 10`.

          Create freestyle project C.
          Throttle on my-category.
          Build step `sleep 10`.
          Trigger downstream project D.

          Create freestyle project D.
          Block on upstream jobs.
          Build step `sleep 10`.

          Trigger A, B, C, and D, in that order.

          ---

          *Expected*

          A starts.
          B starts.
          A finishes.
          B finishes.
          C starts.
          C finishes.
          D starts.
          D finishes.

          ---

          *Actual*

          A starts.
          B starts.
          A finishes.
          *_D starts._*
          B finishes.
          *_C starts._*
          D finishes.
          C finishes.

          D does not wait on C.

          ---

          I also tried lockable resource plugin with the same setup, but it didn't work either.
          New: *Setup*

          Set Jenkins to have one node (master), and two executors.
          Create a throttle category my-category with global max 1.

          Create freestyle project A.
          Build step `sleep 5`.

          Create freestyle project B.
          Throttle on my-category.
          Build step `sleep 10`.

          Create freestyle project C.
          Throttle on my-category.
          Build step `sleep 10`.
          Trigger downstream project D.

          Create freestyle project D.
          Block on upstream jobs.
          Build step `sleep 10`.

          Trigger A, B, C, and D, in that order.

          ---

          *Expected*

          A starts.
          B starts.
          A finishes.
          B finishes.
          C starts.
          C finishes.
          D starts.
          D finishes.

          ---

          *Actual*

          A starts.
          B starts.
          A finishes.
          *_D starts._*
          B finishes.
          *_C starts._*
          D finishes.
          C finishes.

          D does not wait on C.

          ---

          I also tried lockable resource plugin with the same setup, but it didn't work either.

          I do not know of any workaround.
          Paul Draper made changes -
          Description Original: *Setup*

          Set Jenkins to have one node (master), and two executors.
          Create a throttle category my-category with global max 1.

          Create freestyle project A.
          Build step `sleep 5`.

          Create freestyle project B.
          Throttle on my-category.
          Build step `sleep 10`.

          Create freestyle project C.
          Throttle on my-category.
          Build step `sleep 10`.
          Trigger downstream project D.

          Create freestyle project D.
          Block on upstream jobs.
          Build step `sleep 10`.

          Trigger A, B, C, and D, in that order.

          ---

          *Expected*

          A starts.
          B starts.
          A finishes.
          B finishes.
          C starts.
          C finishes.
          D starts.
          D finishes.

          ---

          *Actual*

          A starts.
          B starts.
          A finishes.
          *_D starts._*
          B finishes.
          *_C starts._*
          D finishes.
          C finishes.

          D does not wait on C.

          ---

          I also tried lockable resource plugin with the same setup, but it didn't work either.

          I do not know of any workaround.
          New: *Setup*

          Set Jenkins to have one node (master), and two executors.
          Create a throttle category my-category with global max 1.

          Create freestyle project A.
          Build step `sleep 5`.

          Create freestyle project B.
          Throttle on my-category.
          Build step `sleep 10`.

          Create freestyle project C.
          Throttle on my-category.
          Build step `sleep 10`.
          Post-build, trigger downstream project D.

          Create freestyle project D.
          Block on upstream jobs.
          Build step `sleep 10`.

          Trigger A, B, C, and D, in that order.

          ---

          *Expected*

          A starts.
          B starts.
          A finishes.
          B finishes.
          C starts.
          C finishes.
          D starts.
          D finishes.

          ---

          *Actual*

          A starts.
          B starts.
          A finishes.
          *_D starts._*
          B finishes.
          *_C starts._*
          D finishes.
          C finishes.

          D does not wait on C.

          ---

          I also tried lockable resource plugin with the same setup, but it didn't work either.

          I do not know of any workaround.
          Paul Draper made changes -
          Description Original: *Setup*

          Set Jenkins to have one node (master), and two executors.
          Create a throttle category my-category with global max 1.

          Create freestyle project A.
          Build step `sleep 5`.

          Create freestyle project B.
          Throttle on my-category.
          Build step `sleep 10`.

          Create freestyle project C.
          Throttle on my-category.
          Build step `sleep 10`.
          Post-build, trigger downstream project D.

          Create freestyle project D.
          Block on upstream jobs.
          Build step `sleep 10`.

          Trigger A, B, C, and D, in that order.

          ---

          *Expected*

          A starts.
          B starts.
          A finishes.
          B finishes.
          C starts.
          C finishes.
          D starts.
          D finishes.

          ---

          *Actual*

          A starts.
          B starts.
          A finishes.
          *_D starts._*
          B finishes.
          *_C starts._*
          D finishes.
          C finishes.

          D does not wait on C.

          ---

          I also tried lockable resource plugin with the same setup, but it didn't work either.

          I do not know of any workaround.
          New: *Setup*

          Set Jenkins to have one node (master), and two executors.
          Create a throttle category my-category with global max 1.

          Create freestyle project A.
          Build step `sleep 10`.

          Create freestyle project B.
          Throttle on my-category.
          Build step `sleep 10`.

          Create freestyle project C.
          Throttle on my-category.
          Build step `sleep 10`.
          Post-build, trigger downstream project D.

          Create freestyle project D.
          Block on upstream jobs.
          Build step `sleep 10`.

          Trigger A, B, C, and D, in that order.

          ---

          *Expected*

          A starts.
          B starts.
          A finishes.
          B finishes.
          C starts.
          C finishes.
          D starts.
          D finishes.

          ---

          *Actual*

          A starts.
          B starts.
          A finishes.
          *_D starts._*
          B finishes.
          *_C starts._*
          D finishes.
          C finishes.

          D does not wait on C.

          ---

          I also tried lockable resource plugin with the same setup, but it didn't work either.

          I do not know of any workaround.

          Oleg Nenashev added a comment -

          I would say there's no bug:
          1) You do not throttle D, hence Jenkins is eligible to run it when it has a free executor
          2) "Block on upstream jobs" only prevents conflicts of RUNNING jobs, a task in the queue does not prevent D from starting
          3) C is blocked by throttling, hence Jenkins takes D

          Paul, do you agree?

          Oleg Nenashev added a comment - I would say there's no bug: 1) You do not throttle D, hence Jenkins is eligible to run it when it has a free executor 2) "Block on upstream jobs" only prevents conflicts of RUNNING jobs, a task in the queue does not prevent D from starting 3) C is blocked by throttling, hence Jenkins takes D Paul, do you agree?

            Unassigned Unassigned
            draperp Paul Draper
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: