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

Scanning MultiBranchProject fails with IllegalStateException

    XMLWordPrintable

    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

              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: