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

Downstream build does not wait for upstream build to complete

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • build-pipeline-plugin
    • None
    • Windows Server, Jenkins is installed as Windows Service

      Hi, we have found an issue in our build pipeline. We are using Jenkins ver. 1.554.1

      The setup is as follows:

      • The master does not execute builds
      • There are multiple slave nodes connected to the master. All builds are executed on the slaves
      • Job A
        • is polling for SCM
        • is set to have a quiet period of 10 seconds
        • on build, is generating an artifact
      • Job B
        • is polling for SCM
        • is set to have a quiet period of 10 seconds
        • is set to be dependent on Job A ("Build after other projects are built")
        • is set to not build when upstream jobs are building ("Block build when upstream project is building")
        • on build, downloads $HUDSON_URL/job/A/lastSuccessfulBuild/[path-to-artifact]/artifact.zip

      Given that

      • Job A's last successful build is #9
      • Job B's last successful build is #19
      • User Eve checks in files to a location observed by both jobs
      • User Eve checks in files such that both jobs will detect an SCM change

      We can now observe the following sequence of events:

      1. Job A observes the changes and triggers build #10 that is put into the waiting queue
      2. Job B observes the changes and triggers build #20 that is put into the waiting queue
      3. The quiet period elapses, job A build #10 starts to build
      4. Job A build #10 is finished generating the artifact, it is uploaded to the master
      5. Job A build #10 tries to trigger a new build of Job B. Job B build #20 is already in the waiting queue, so no new build is triggered
      6. Job A build #10 does not complete for the next 30 seconds. we believe this is due to uploading the build log to the master, but we are uncertain about this. (correction: it was due to the disk usage plugin, which we now removed. There is no noticable delay anymore, but the problem described here persists)
      7. Job B build #20 starts to build
      8. Job B build #20 downloads $HUDSON_URL/job/A/lastSuccessfulBuild/[path-to-artifact]/artifact.zip (lastSuccessfulBuild seems to point to Job A build #9 at this time)
      9. Job A completes with the message "Finished: SUCCESS"
      10. Job B completes with the message "Finished: SUCCESS"
      11. No more builds of Jobs A and B are pending/will be running

      We are uncertain whether the problem lies in step 7 or step 8. Our requirement is that Job B build #20 downloads the artifact of the last succeeded build of job A, which should be build #10. This seems like a bug to us.

      This issue seems related to JENKINS-5125. Looking at the source code reveals that this code fragment proposed in JENKINS-5125 is not implemented:

      public boolean isBuilding() {
          RunT b = getLastBuild();
          return b!=null && b.isLogUpdated();
      }
      

      We think there might be a chance that implementing this code fragment would also fix our issue.

            Unassigned Unassigned
            banjobenisma Benjamin Ernst
            Votes:
            3 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: