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

Block on upstream projects does not work

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            Is this now not fixed?

            Show
            jglick Jesse Glick added a comment - Is this now not fixed?
            Hide
            stephenconnolly Stephen Connolly added a comment -

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

            Show
            stephenconnolly Stephen Connolly added a comment - As far as I understand this is resolved now in 1.610+
            Hide
            scm_issue_link 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)

            Show
            scm_issue_link 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)
            Hide
            scm_issue_link 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

            Show
            scm_issue_link 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
            Hide
            dogfood 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
            Show
            dogfood 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

              People

              • Assignee:
                stephenconnolly Stephen Connolly
                Reporter:
                draperp Paul Draper
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: