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

Scanning MultiBranchProject fails with IllegalStateException

    Details

    • Similar Issues:

      Description

      Initial scan of branches in a multi-branch-project fails with an IllegalStateException.

      Steps to duplicate the problem:

      1. Clone, build, and run the docker instance
          $ git clone https://github.com/MarkEWaite/docker JENKINS-41867
          $ cd JENKINS-41867
          $ git checkout -b lts-with-plugins dac2eebcf7afc90caf9180a9f6a6de6d98ae26b6 # -t origin/lts-with-plugins
          $ docker build -t jenkins:JENKINS-41867 .
          $ docker run -i --rm --publish 8080:8080 jenkins:JENKINS-41867
        
      2. Connect a web browser to that docker instance (http://localhost:8080)
      3. Open the "Git Client Plugin Folder"
      4. Open the "Git Client Branches - Maven" multi-branch job
      5. Click the "Scan Project" link and then the "Run Now" link to start branch indexing
      6. Click the "Log" link to view the log - stack trace will appear in that log

      The problem seems to be new with scm-api 2.0.3. Prior versions of scm-api did not show the same behavior.

      Stack trace is:

      Started by user Mark Waite
      [Wed Feb 08 16:59:22 MST 2017] Starting branch indexing...
      Creating git repository in /var/jenkins_home/caches/git-65641b79111589c081c788caa640559c
       > git init /var/jenkins_home/caches/git-65641b79111589c081c788caa640559c # timeout=11
      Setting origin to https://github.com/MarkEWaite/git-plugin.git
       > git config remote.origin.url https://github.com/MarkEWaite/git-plugin.git # timeout=11
      Fetching & pruning origin...
      Fetching upstream changes from origin
       > git --version # timeout=11
      using GIT_ASKPASS to set credentials intentionally invalid user and password for credentials NPE in multi-branch jobs
       > git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* --prune
      Getting remote branches...
      Seen branch in repository origin/2.6.x
      Seen branch in repository origin/3.0.0-PR439-add-ATH-subset-to-Jenkinsfile
      Seen branch in repository origin/master
      Seen branch in repository origin/master-PR439-add-ATH-subset-to-Jenkinsfile
      Seen branch in repository origin/master-PR463-add-git-lfs
      Seen branch in repository origin/master-PRxxx-move-findbugs-suppressions-into-code
      Seen branch in repository origin/master-findbugs-combined
      Seen branch in repository origin/master-findbugs-fixes
      Seen branch in repository origin/ongoing/latest-jenkins-lts
      Seen branch in repository origin/ongoing/lts
      Seen 10 remote branches
      Checking branch master-PR463-add-git-lfs
      Scheduled build for branch: master-PR463-add-git-lfs
      Checking branch ongoing/lts
      Checking branch master
      Checking branch master-PR439-add-ATH-subset-to-Jenkinsfile
      ERROR: [Wed Feb 08 16:59:24 MST 2017] Could not fetch branches from source d7205f38-9ade-472c-923c-6a839d7ec90d
      java.lang.IllegalStateException: Did not call mayCreate, or used the wrong Item.name for hudson.model.FreeStyleProject@689690d2[Git-Folder/git-plugin-freestyle-multi-branch/master-PR4.l4tko8c5k0.enkinsfile] with name master-PR4.l4tko8c5k0.enkinsfile among [master-PR439-add-ATH-subset-to-Jenkinsfile, master-PR463-add-git-lfs]
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder$FullReindexChildObserver.created(ComputedFolder.java:667)
      	at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observe(MultiBranchProject.java:1957)
      	at jenkins.plugins.git.AbstractGitSCMSource$2.run(AbstractGitSCMSource.java:315)
      	at jenkins.plugins.git.AbstractGitSCMSource$2.run(AbstractGitSCMSource.java:239)
      	at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:209)
      	at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:239)
      	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:300)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:210)
      	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:625)
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:219)
      	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:141)
      	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:969)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:404)
      [Wed Feb 08 16:59:24 MST 2017] Finished branch indexing. Indexing took 2.3 sec
      FATAL: Failed to recompute children of Git Plugin Folder ยป Git Branches - Maven
      java.lang.IllegalStateException: Did not call mayCreate, or used the wrong Item.name for hudson.model.FreeStyleProject@689690d2[Git-Folder/git-plugin-freestyle-multi-branch/master-PR4.l4tko8c5k0.enkinsfile] with name master-PR4.l4tko8c5k0.enkinsfile among [master-PR439-add-ATH-subset-to-Jenkinsfile, master-PR463-add-git-lfs]
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder$FullReindexChildObserver.created(ComputedFolder.java:667)
      	at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observe(MultiBranchProject.java:1957)
      	at jenkins.plugins.git.AbstractGitSCMSource$2.run(AbstractGitSCMSource.java:315)
      	at jenkins.plugins.git.AbstractGitSCMSource$2.run(AbstractGitSCMSource.java:239)
      	at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:209)
      	at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:239)
      	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:300)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:210)
      	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:625)
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:219)
      	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:141)
      	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:969)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:404)
      Finished: FAILURE
      

      Addendum - it appears I'm wrong about the root cause. I reverted scm-api 2.0.3, switching back to scm-api 2.0.2 and see the same behavior. Sorry for the false alarm on scm-api 2.0.3. My initial attempts to bisect the problem have failed. Please ignore this bug report until I investigate further.

      Second addendum - this bug is not visible with the updates applied as of 10 Feb 2017, it is now obscured by the more severe bug JENKINS-41948

      Third addendum - refer to multi-branch-project-plugin.hpi for a plugin compiled with the proposed pull request that resolves the issue.

        Attachments

          Issue Links

            Activity

            Hide
            vlk Vladimir Kralik added a comment -

            Stephen Connolly said :
            Vladimir Kralik you need to upgrade multi-branch-project-plugin.hpi to get the fix

            I've installed the latest version of multi-branch-project-plugin.hpi ( 0.5.1 ) and the problem still persists.

            [418D226A0DD6E28D66A2D5E7B1577BFE9FA54AB7-drg-sk-rules-svc-health_hudson-hg] $ hg --config hostfingerprints.hg=18:CF:17:C1:0B:1F:03:A0:C2:06:BE:B2:E3:9E:DA:A1:31:A0:D4:06 --config hostfingerprints.hg.assecosk.local=18:CF:17:C1:0B:1F:03:A0:C2:06:BE:B2:E3:9E:DA:A1:31:A0:D4:06 --config auth.jenkins.prefix=* --config ******** --config ******** --config "auth.jenkins.schemes=http https" heads --template "{node} {branch}\n"
            
            Found branch stx-3.0a
            ERROR: [Tue Feb 21 06:52:13 UTC 2017] Could not fetch branches from source f91e81df-0b14-4805-96ab-430dca6b0ab5
            java.lang.IllegalStateException: Did not call mayCreate, or used the wrong Item.name for hudson.maven.MavenModuleSet@51fd39f9[drg.drg-sk-rules/stx-3-0a.0r0cva] with name stx-3-0a.0r0cva among [stx-3.0a]
            	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder$FullReindexChildObserver.created(ComputedFolder.java:667)
            	at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observe(MultiBranchProject.java:2003)
            	at hudson.plugins.mercurial.MercurialSCMSource.retrieve(MercurialSCMSource.java:183)
            	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:300)
            	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:210)
            	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:634)
            	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:219)
            	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:141)
            	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:973)
            	at hudson.model.ResourceController.execute(ResourceController.java:98)
            	at hudson.model.Executor.run(Executor.java:404)
            [Tue Feb 21 06:52:13 UTC 2017] Finished branch indexing. Indexing took 0.82 sec
            FATAL: Failed to recompute children of drg.drg-sk-rules
            java.lang.IllegalStateException: Did not call mayCreate, or used the wrong Item.name for hudson.maven.MavenModuleSet@51fd39f9[drg.drg-sk-rules/stx-3-0a.0r0cva] with name stx-3-0a.0r0cva among [stx-3.0a]
            	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder$FullReindexChildObserver.created(ComputedFolder.java:667)
            	at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observe(MultiBranchProject.java:2003)
            	at hudson.plugins.mercurial.MercurialSCMSource.retrieve(MercurialSCMSource.java:183)
            	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:300)
            	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:210)
            	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:634)
            	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:219)
            	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:141)
            	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:973)
            	at hudson.model.ResourceController.execute(ResourceController.java:98)
            	at hudson.model.Executor.run(Executor.java:404)
            Finished: FAILURE
            
            Show
            vlk Vladimir Kralik added a comment - Stephen Connolly said : Vladimir Kralik you need to upgrade multi-branch-project-plugin.hpi to get the fix I've installed the latest version of multi-branch-project-plugin.hpi ( 0.5.1 ) and the problem still persists. [418D226A0DD6E28D66A2D5E7B1577BFE9FA54AB7-drg-sk-rules-svc-health_hudson-hg] $ hg --config hostfingerprints.hg=18:CF:17:C1:0B:1F:03:A0:C2:06:BE:B2:E3:9E:DA:A1:31:A0:D4:06 --config hostfingerprints.hg.assecosk.local=18:CF:17:C1:0B:1F:03:A0:C2:06:BE:B2:E3:9E:DA:A1:31:A0:D4:06 --config auth.jenkins.prefix=* --config ******** --config ******** --config "auth.jenkins.schemes=http https" heads --template "{node} {branch}\n" Found branch stx-3.0a ERROR: [Tue Feb 21 06:52:13 UTC 2017] Could not fetch branches from source f91e81df-0b14-4805-96ab-430dca6b0ab5 java.lang.IllegalStateException: Did not call mayCreate, or used the wrong Item.name for hudson.maven.MavenModuleSet@51fd39f9[drg.drg-sk-rules/stx-3-0a.0r0cva] with name stx-3-0a.0r0cva among [stx-3.0a] at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder$FullReindexChildObserver.created(ComputedFolder.java:667) at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observe(MultiBranchProject.java:2003) at hudson.plugins.mercurial.MercurialSCMSource.retrieve(MercurialSCMSource.java:183) at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:300) at jenkins.scm.api.SCMSource.fetch(SCMSource.java:210) at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:634) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:219) at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:141) at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:973) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:404) [Tue Feb 21 06:52:13 UTC 2017] Finished branch indexing. Indexing took 0.82 sec FATAL: Failed to recompute children of drg.drg-sk-rules java.lang.IllegalStateException: Did not call mayCreate, or used the wrong Item.name for hudson.maven.MavenModuleSet@51fd39f9[drg.drg-sk-rules/stx-3-0a.0r0cva] with name stx-3-0a.0r0cva among [stx-3.0a] at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder$FullReindexChildObserver.created(ComputedFolder.java:667) at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observe(MultiBranchProject.java:2003) at hudson.plugins.mercurial.MercurialSCMSource.retrieve(MercurialSCMSource.java:183) at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:300) at jenkins.scm.api.SCMSource.fetch(SCMSource.java:210) at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:634) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:219) at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:141) at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:973) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:404) Finished: FAILURE
            Hide
            evildeece Alastair D'Silva added a comment -

            Vladimir Kralik the attached plugin fixed it for me. Did you restart after applying it? If so, could you please post an inventory of your installed plugins? That will make it a bit easier to figure out what the problem is.

            Show
            evildeece Alastair D'Silva added a comment - Vladimir Kralik the attached plugin fixed it for me. Did you restart after applying it? If so, could you please post an inventory of your installed plugins? That will make it a bit easier to figure out what the problem is.
            Hide
            mbtc Marcus Collins added a comment -

            Hello, I have found that if I leave the branch-api plugin at my current version (1.11.1), the issue does not occur in our normal system.
            I have also tested the above HPI file with the latest plugins in a sandbox Jenkins installation and this also fixed the issue.

            Show
            mbtc Marcus Collins added a comment - Hello, I have found that if I leave the branch-api plugin at my current version (1.11.1), the issue does not occur in our normal system. I have also tested the above HPI file with the latest plugins in a sandbox Jenkins installation and this also fixed the issue.
            Hide
            kpop kpop added a comment -

            The attached plugin also fixes the issue for me. Thank you!

            Show
            kpop kpop added a comment - The attached plugin also fixes the issue for me. Thank you!
            Hide
            mjdetullio Matthew DeTullio added a comment -

            Fixed in version 0.6

            Show
            mjdetullio Matthew DeTullio added a comment - Fixed in version 0.6

              People

              • Assignee:
                mjdetullio Matthew DeTullio
                Reporter:
                markewaite Mark Waite
              • Votes:
                9 Vote for this issue
                Watchers:
                14 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: