• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • core

      Do a fresh install of Jenkins. Make 3+ executors.

      Create project A, with downstream B.
      Have it `sleep 15`.

      Create project B, with downstream C.
      Set it to block on building upstream projects.
      Have it `sleep 30`.

      Create project C.
      Set it to block on building upstream projects.
      Have it `sleep 30`.

      Trigger A, B, and C together, in succession.

      As A builds, notice that C is blocked, and waits for the (transitive) upstream project A to finish.

      However, once A finished, B and C both start!

      Only B should have started. C should have stayed blocked until B finished. Instead, C behaved as if A – and A alone – were the upstream project.

          [JENKINS-27871] Block on upstream projects does not work

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          core/src/main/java/hudson/model/Queue.java
          http://jenkins-ci.org/commit/jenkins/5880ed830201f9349ae9def6653c19a186e1eb18
          Log:
          [FIXED JENKINS-27708][FIXED JENKINS-27871] Ensure that identification of blocked tasks is using the live state.

          • The creation of a snapshot itself should be relatively cheap given the expected rate of
            job execution. You probably would need 100's of jobs starting execution every iteration
            of maintain() before this could even start to become an issue and likely the calculation
            of isBuildBlocked(p) will become a bottleneck before updateSnapshot() will. Additionally
            since the snapshot itself only ever has at most one reference originating outside of the stack
            it should remain in the eden space and thus be cheap to GC.
          • JENKINS-27708 comments 225819 and 225906 provide more complex but logically equivalent fixes of
            this issue. I am favouring this approach as it is simpler and provides less scope for error as any
            new helper methods can just rely on the snapshot being up to date whereas with the other
            two candidates if a new helper method is introduced there is the potential to miss adding support
            for the live view. The comment 225819 has the risk of introducing extra lock contention while
            the comment 225906 version forces every access to the helper methods to pass a second memory
            barrier

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: core/src/main/java/hudson/model/Queue.java http://jenkins-ci.org/commit/jenkins/5880ed830201f9349ae9def6653c19a186e1eb18 Log: [FIXED JENKINS-27708] [FIXED JENKINS-27871] Ensure that identification of blocked tasks is using the live state. The creation of a snapshot itself should be relatively cheap given the expected rate of job execution. You probably would need 100's of jobs starting execution every iteration of maintain() before this could even start to become an issue and likely the calculation of isBuildBlocked(p) will become a bottleneck before updateSnapshot() will. Additionally since the snapshot itself only ever has at most one reference originating outside of the stack it should remain in the eden space and thus be cheap to GC. JENKINS-27708 comments 225819 and 225906 provide more complex but logically equivalent fixes of this issue. I am favouring this approach as it is simpler and provides less scope for error as any new helper methods can just rely on the snapshot being up to date whereas with the other two candidates if a new helper method is introduced there is the potential to miss adding support for the live view. The comment 225819 has the risk of introducing extra lock contention while the comment 225906 version forces every access to the helper methods to pass a second memory barrier

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          test/src/test/java/hudson/model/QueueTest.java
          http://jenkins-ci.org/commit/jenkins/7514e8c6ce35283da4a8bb4422fe885350fc8681
          Log:
          JENKINS-27871 - Added a direct unit test for the issue

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: test/src/test/java/hudson/model/QueueTest.java http://jenkins-ci.org/commit/jenkins/7514e8c6ce35283da4a8bb4422fe885350fc8681 Log: JENKINS-27871 - Added a direct unit test for the issue

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          test/src/test/java/hudson/model/QueueTest.java
          http://jenkins-ci.org/commit/jenkins/57efbea3d0326f8b24bbe458fa1d25f6f45589f8
          Log:
          Merge pull request #2 from oleg-nenashev/JENKINS-27871

          JENKINS-27871 - Added a direct unit test for the issue

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: test/src/test/java/hudson/model/QueueTest.java http://jenkins-ci.org/commit/jenkins/57efbea3d0326f8b24bbe458fa1d25f6f45589f8 Log: Merge pull request #2 from oleg-nenashev/ JENKINS-27871 JENKINS-27871 - Added a direct unit test for the issue

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          core/src/main/java/hudson/model/Queue.java
          test/src/test/java/hudson/model/QueueTest.java
          http://jenkins-ci.org/commit/jenkins/152d00ad09931c10f02fab4ac8a42e574d622bd3
          Log:
          Merge pull request #1645 from stephenc/jenkins-27708

          JENKINS-27708, JENKINS-27871 Ensure that identification of blocked tasks is using the live state.

          Compare: https://github.com/jenkinsci/jenkins/compare/b688047877cf...152d00ad0993

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: core/src/main/java/hudson/model/Queue.java test/src/test/java/hudson/model/QueueTest.java http://jenkins-ci.org/commit/jenkins/152d00ad09931c10f02fab4ac8a42e574d622bd3 Log: Merge pull request #1645 from stephenc/jenkins-27708 JENKINS-27708 , JENKINS-27871 Ensure that identification of blocked tasks is using the live state. Compare: https://github.com/jenkinsci/jenkins/compare/b688047877cf...152d00ad0993

          dogfood added a comment -

          Integrated in jenkins_main_trunk #4087

          Result = SUCCESS

          dogfood added a comment - Integrated in jenkins_main_trunk #4087 Result = SUCCESS

          Jesse Glick added a comment -

          Is this now not fixed?

          Jesse Glick added a comment - Is this now not fixed?

          As far as I understand this is resolved now in 1.610+

          Stephen Connolly added a comment - As far as I understand this is resolved now in 1.610+

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          core/src/main/java/hudson/model/Queue.java
          http://jenkins-ci.org/commit/jenkins/11b89d9c0b46f0afad0ca86a11264b503b799c2e
          Log:
          [FIXED JENKINS-27708][FIXED JENKINS-27871] Ensure that identification of blocked tasks is using the live state.

          • The creation of a snapshot itself should be relatively cheap given the expected rate of
            job execution. You probably would need 100's of jobs starting execution every iteration
            of maintain() before this could even start to become an issue and likely the calculation
            of isBuildBlocked(p) will become a bottleneck before updateSnapshot() will. Additionally
            since the snapshot itself only ever has at most one reference originating outside of the stack
            it should remain in the eden space and thus be cheap to GC.
          • JENKINS-27708 comments 225819 and 225906 provide more complex but logically equivalent fixes of
            this issue. I am favouring this approach as it is simpler and provides less scope for error as any
            new helper methods can just rely on the snapshot being up to date whereas with the other
            two candidates if a new helper method is introduced there is the potential to miss adding support
            for the live view. The comment 225819 has the risk of introducing extra lock contention while
            the comment 225906 version forces every access to the helper methods to pass a second memory
            barrier

          (cherry picked from commit 5880ed830201f9349ae9def6653c19a186e1eb18)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: core/src/main/java/hudson/model/Queue.java http://jenkins-ci.org/commit/jenkins/11b89d9c0b46f0afad0ca86a11264b503b799c2e Log: [FIXED JENKINS-27708] [FIXED JENKINS-27871] Ensure that identification of blocked tasks is using the live state. The creation of a snapshot itself should be relatively cheap given the expected rate of job execution. You probably would need 100's of jobs starting execution every iteration of maintain() before this could even start to become an issue and likely the calculation of isBuildBlocked(p) will become a bottleneck before updateSnapshot() will. Additionally since the snapshot itself only ever has at most one reference originating outside of the stack it should remain in the eden space and thus be cheap to GC. JENKINS-27708 comments 225819 and 225906 provide more complex but logically equivalent fixes of this issue. I am favouring this approach as it is simpler and provides less scope for error as any new helper methods can just rely on the snapshot being up to date whereas with the other two candidates if a new helper method is introduced there is the potential to miss adding support for the live view. The comment 225819 has the risk of introducing extra lock contention while the comment 225906 version forces every access to the helper methods to pass a second memory barrier (cherry picked from commit 5880ed830201f9349ae9def6653c19a186e1eb18)

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          test/src/test/java/hudson/model/QueueTest.java
          http://jenkins-ci.org/commit/jenkins/0d1efdad304df3c9cf5bd9157cce9e9fec5643aa
          Log:
          JENKINS-27871 - Added a direct unit test for the issue

          (cherry picked from commit 7514e8c6ce35283da4a8bb4422fe885350fc8681)

          Compare: https://github.com/jenkinsci/jenkins/compare/58edc35abf6c^...0d1efdad304d

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: test/src/test/java/hudson/model/QueueTest.java http://jenkins-ci.org/commit/jenkins/0d1efdad304df3c9cf5bd9157cce9e9fec5643aa Log: JENKINS-27871 - Added a direct unit test for the issue (cherry picked from commit 7514e8c6ce35283da4a8bb4422fe885350fc8681) Compare: https://github.com/jenkinsci/jenkins/compare/58edc35abf6c ^...0d1efdad304d

          dogfood added a comment -

          Integrated in jenkins_main_trunk #4292
          [FIXED JENKINS-27708][FIXED JENKINS-27871] Ensure that identification of blocked tasks is using the live state. (Revision 11b89d9c0b46f0afad0ca86a11264b503b799c2e)
          JENKINS-27871 - Added a direct unit test for the issue (Revision 0d1efdad304df3c9cf5bd9157cce9e9fec5643aa)

          Result = UNSTABLE
          ogondza : 11b89d9c0b46f0afad0ca86a11264b503b799c2e
          Files :

          • core/src/main/java/hudson/model/Queue.java

          ogondza : 0d1efdad304df3c9cf5bd9157cce9e9fec5643aa
          Files :

          • test/src/test/java/hudson/model/QueueTest.java

          dogfood added a comment - Integrated in jenkins_main_trunk #4292 [FIXED JENKINS-27708] [FIXED JENKINS-27871] Ensure that identification of blocked tasks is using the live state. (Revision 11b89d9c0b46f0afad0ca86a11264b503b799c2e) JENKINS-27871 - Added a direct unit test for the issue (Revision 0d1efdad304df3c9cf5bd9157cce9e9fec5643aa) Result = UNSTABLE ogondza : 11b89d9c0b46f0afad0ca86a11264b503b799c2e Files : core/src/main/java/hudson/model/Queue.java ogondza : 0d1efdad304df3c9cf5bd9157cce9e9fec5643aa Files : test/src/test/java/hudson/model/QueueTest.java

            stephenconnolly Stephen Connolly
            draperp Paul Draper
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: