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

java.lang.IllegalStateException: Jenkins\Job\ID already existed; will not overwrite with JobName\ID at hudson.model.RunMap.put(RunMap.java:188)

      Jenkins ver. 1.642

      This is occuring on freestyle builds that are triggered by a cron expression and an upstream job (promotions plugin). When those triggers both happen close to each other it seams to "kill" the executor due to the IllegalStateExceptionThese are newer builds (#533, #532) but still its trying to run the [JobName]\builds\405 ,which already exists. Normally, it should trigger #533, #532 newer jobs IDs. We are constantly able to reproduce the issue every time a child job is triggered by the parent job using "Trigger call/builds on another projects" feature.

      Exception:

      java.lang.IllegalStateException: C:\Program Files (x86)\Jenkins\jobs[JobName]\builds\405 already existed; will not overwrite with [JobName] #405
      at hudson.model.RunMap.put(RunMap.java:188)
      at jenkins.model.lazy.LazyBuildMixIn.newBuild(LazyBuildMixIn.java:176)
      at hudson.model.AbstractProject.newBuild(AbstractProject.java:1019)
      at hudson.model.AbstractProject.createExecutable(AbstractProject.java:1210)
      at hudson.model.AbstractProject.createExecutable(AbstractProject.java:145)
      at hudson.model.Executor$1.call(Executor.java:364)
      at hudson.model.Executor$1.call(Executor.java:346)
      at hudson.model.Queue._withLock(Queue.java:1405)
      at hudson.model.Queue.withLock(Queue.java:1270)
      at hudson.model.Executor.run(Executor.java:346)

      Jenkins in 1.607 (2015/03/30) - Has changes which removes race condition rendering the list of executors (issue 27564) might be causing this race condition issue.

      Similar threads:
      https://issues.jenkins-ci.org/browse/JENKINS-29268 [Configuration race condition]
      https://issues.jenkins-ci.org/browse/JENKINS-26582 [also has this issue for ver 1.621]

      Any idea for resolving this issue, we are constantly getting the executer failures states.

          [JENKINS-32152] java.lang.IllegalStateException: Jenkins\Job\ID already existed; will not overwrite with JobName\ID at hudson.model.RunMap.put(RunMap.java:188)

          Daniel Beck added a comment -

          Weird.

          Would be interesting to know whether there are files named "atomic" in the affected job's directory.

          Also, can be resolved by setting a higher next build number. Use e.g. the Set Next Build Number plugin to do that.

          Daniel Beck added a comment - Weird. Would be interesting to know whether there are files named "atomic" in the affected job's directory. Also, can be resolved by setting a higher next build number. Use e.g. the Set Next Build Number plugin to do that.

          Riddhi Sharma added a comment - - edited

          Thank you Daniel for the response. No, we couldn't find any files named "atomic" in the jobs directory or entire jenkins directory. Using Set Next Build Number needs manual input to set the next build number, which we do not want.

          This is surprising that setting up the next increment build number is jenkins core functionality where we are facing issue while using Promotions (promoted builds plugin - version 2.19 though 2.24.1 is available. Would it be good to do the update?

          Also, if we look at the error message below, the illegal state exception is happening and build executor are getting dead when
          SEVERE: Unexpected executor death because it found the builds 18 already existing and could not overwrite.

          Error

          java.lang.IllegalStateException: C:\Program Files (x86)\Jenkins\jobs\build.pii.A.trunk\promotions\STEP 1 - Promote to DEV\builds\18 already existed; will not overwrite with build.pii.A.trunk/promotion/STEP 1 - Promote to DEV #18
          at hudson.model.RunMap.put(RunMap.java:188)
          at jenkins.model.lazy.LazyBuildMixIn.newBuild(LazyBuildMixIn.java:176)
          at hudson.model.AbstractProject.newBuild(AbstractProject.java:1019)
          at hudson.model.AbstractProject.createExecutable(AbstractProject.java:1210)
          at hudson.model.AbstractProject.createExecutable(AbstractProject.java:145)
          at hudson.model.Executor$1.call(Executor.java:364)
          at hudson.model.Executor$1.call(Executor.java:346)
          at hudson.model.Queue._withLock(Queue.java:1405)
          at hudson.model.Queue.withLock(Queue.java:1270)
          at hudson.model.Executor.run(Executor.java:346)

          Riddhi Sharma added a comment - - edited Thank you Daniel for the response. No, we couldn't find any files named "atomic" in the jobs directory or entire jenkins directory. Using Set Next Build Number needs manual input to set the next build number, which we do not want. This is surprising that setting up the next increment build number is jenkins core functionality where we are facing issue while using Promotions (promoted builds plugin - version 2.19 though 2.24.1 is available. Would it be good to do the update? Also, if we look at the error message below, the illegal state exception is happening and build executor are getting dead when SEVERE: Unexpected executor death because it found the builds 18 already existing and could not overwrite. Error java.lang.IllegalStateException: C:\Program Files (x86)\Jenkins\jobs\build.pii.A.trunk\promotions\STEP 1 - Promote to DEV\builds\18 already existed; will not overwrite with build.pii.A.trunk/promotion/STEP 1 - Promote to DEV #18 at hudson.model.RunMap.put(RunMap.java:188) at jenkins.model.lazy.LazyBuildMixIn.newBuild(LazyBuildMixIn.java:176) at hudson.model.AbstractProject.newBuild(AbstractProject.java:1019) at hudson.model.AbstractProject.createExecutable(AbstractProject.java:1210) at hudson.model.AbstractProject.createExecutable(AbstractProject.java:145) at hudson.model.Executor$1.call(Executor.java:364) at hudson.model.Executor$1.call(Executor.java:346) at hudson.model.Queue._withLock(Queue.java:1405) at hudson.model.Queue.withLock(Queue.java:1270) at hudson.model.Executor.run(Executor.java:346)

          Jesse Glick added a comment -

          Are you using Reload Configuration from Disk by any chance?

          Jesse Glick added a comment - Are you using Reload Configuration from Disk by any chance?

          Riddhi Sharma added a comment - - edited

          Thanks Jesse for the suggestion. We have already tried _ Reload Configuration from Disk _ multiple times but the problem still remains and this is happening when we are trying to use the promoted builds plugin to trigger the child jobs. I wanted to understand what is exactly making the builds throw java.lang.IllegalStateException

          Exception Lines

          at hudson.model.RunMap.put(RunMap.java:188)
          at jenkins.model.lazy.LazyBuildMixIn.newBuild(LazyBuildMixIn.java:176)
          at hudson.model.AbstractProject.newBuild(AbstractProject.java:1019)
          at hudson.model.AbstractProject.createExecutable(AbstractProject.java:1210)

          specifically when trying to create new Build.

          Riddhi Sharma added a comment - - edited Thanks Jesse for the suggestion. We have already tried _ Reload Configuration from Disk _ multiple times but the problem still remains and this is happening when we are trying to use the promoted builds plugin to trigger the child jobs. I wanted to understand what is exactly making the builds throw java.lang.IllegalStateException Exception Lines at hudson.model.RunMap.put(RunMap.java:188) at jenkins.model.lazy.LazyBuildMixIn.newBuild(LazyBuildMixIn.java:176) at hudson.model.AbstractProject.newBuild(AbstractProject.java:1019) at hudson.model.AbstractProject.createExecutable(AbstractProject.java:1210) specifically when trying to create new Build.

          Riddhi Sharma added a comment - - edited

          We have fixed this issue. Posting the cause and fix here to help out others.

          ROOT CAUSE: This issue was caused by the upgrade we performed recently on Jenkins. If the upgrade caused Jenkins to forget date/time and build numbers in history. This reset of build number counters is causing conflicts in the promotions.

          FIX: To fix this we should manually go into the ‘C:\Program Files (x86)\Jenkins\jobs**\promotions folder and remove numerical historical folders that are greater than the current promoted build number. This will alleviate the issue entirely.

          This fix worked in our case.

          Riddhi Sharma added a comment - - edited We have fixed this issue. Posting the cause and fix here to help out others. ROOT CAUSE: This issue was caused by the upgrade we performed recently on Jenkins. If the upgrade caused Jenkins to forget date/time and build numbers in history. This reset of build number counters is causing conflicts in the promotions. FIX: To fix this we should manually go into the ‘C:\Program Files (x86)\Jenkins\jobs**\promotions folder and remove numerical historical folders that are greater than the current promoted build number. This will alleviate the issue entirely. This fix worked in our case.

            riiddss Riddhi Sharma
            riiddss Riddhi Sharma
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: