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

Multi-config project concurrent build race

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • Jenkins ver. 1.597
      Matrix project plugin ver. 1.4
      Gerrit trigger ver. 2.12.0
      Gerrit ver. 2.8.3
      Master running on an Ubuntu 10.04.1 machine
      2 slaves running on Ubuntu 14.04.1 machines

      I have a multi-config job (4 configurations) with "Execute concurrent builds if necessary" enabled. The job is triggered by new patch sets being pushed to gerrit (using the Gerrit trigger plugin).

      This seems to work fine when only pushing a single new patch set to gerrit at a time. When two new patch sets are pushed at the same time (git add, git commit, git add, git commit, git push) all 4 sub-builds will fail for one of the patch sets with errors like this (and bring down the Jenkins thread they are running on):

      java.lang.IllegalStateException: cannot create a build with number 252 since that (or higher) is already in use among [151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 253]
      	at jenkins.model.lazy.AbstractLazyLoadRunMap.proposeNewNumber(AbstractLazyLoadRunMap.java:361)
      	at hudson.model.RunMap.put(RunMap.java:189)
      	at hudson.matrix.MatrixConfiguration.newBuild(MatrixConfiguration.java:284)
      	at hudson.matrix.MatrixConfiguration.newBuild(MatrixConfiguration.java:74)
      	at hudson.model.AbstractProject.createExecutable(AbstractProject.java:1200)
      	at hudson.model.AbstractProject.createExecutable(AbstractProject.java:144)
      	at hudson.model.Executor.run(Executor.java:213)
      

      In this case build 252 was the build number for the bad patch set, 253 for the good patch set. My guess as to what happened is that the parent builds started in one order (252, then 253) but the sub-builds started in the opposite order (253, then 252). The Jenkins log is missing messages about the 252 sub-builds though so I can't confirm this (presumably the sub-build started messages are missing because the threads died before writing the messages).

      I don't know if this is just a race condition as suggested in the title or if it is a problem with how the gerrit trigger plugin launches jobs when more than one new patch set is introduced by a single push to gerrit.

            jglick Jesse Glick
            demett David Emett
            Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: