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

Unable to checkout repository with git-plugin ArrayIndexOutOfBoundsException

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • git-client-plugin
    • None
    • Windows Server 2016 64-bit

      Currently running the latest version of Jenkins with the latest plugins required for Blue Ocean.

      Jenkins is unable to check-out certain repositories that we use for an unknown reason.
      The ArrayIndexOutOfBoundsException us occurring here:

      https://github.com/jenkinsci/git-client-plugin/blob/master/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java#L2043

      java.lang.ArrayIndexOutOfBoundsException: 1
       at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.parseBranches(CliGitAPIImpl.java:2043)
       at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getBranches(CliGitAPIImpl.java:2064)
       at hudson.plugins.git.GitAPI.getBranches(GitAPI.java:195)
       at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2199)
       at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
       at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
       at hudson.remoting.UserRequest.perform(UserRequest.java:153)
       at hudson.remoting.UserRequest.perform(UserRequest.java:50)
       at hudson.remoting.Request$2.run(Request.java:336)
       at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
       at hudson.remoting.Engine$1$1.run(Engine.java:94)
       at java.lang.Thread.run(Thread.java:748)
       at ......remote call to JNLP4-connect connection from JENKINSSLAVE01/10.200.8.6:57602(Native Method)
       at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545)
       at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
       at hudson.remoting.Channel.call(Channel.java:830)
       at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
       at com.sun.proxy.$Proxy105.execute(Unknown Source)
       at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1167)
       at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
       at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85)
       at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75)
       at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
       at hudson.security.ACL.impersonate(ACL.java:260)
       at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
       at java.lang.Thread.run(Thread.java:748)
      

          [JENKINS-45894] Unable to checkout repository with git-plugin ArrayIndexOutOfBoundsException

          Chris Franco added a comment -

          Hey Mark.

          Sorry for taking a while to reply. Been experimenting trying to find the root cause of this issue.
          After messing around with quite a bit I've been led to believe there's a problem with the GitScm plugin parsing some of the Git history in two of repositories we use.

          For the culprit repository I created a new repository with the same levels of permission and copied all the files to it and ran it through the GitScm plugin via a simple pipeline (like the one described above) and it worked just fine.

          I'm unsure what else I can do to try to this repository to attempt to get it to accept its data.

          Chris Franco added a comment - Hey Mark. Sorry for taking a while to reply. Been experimenting trying to find the root cause of this issue. After messing around with quite a bit I've been led to believe there's a problem with the GitScm plugin parsing some of the Git history in two of repositories we use. For the culprit repository I created a new repository with the same levels of permission and copied all the files to it and ran it through the GitScm plugin via a simple pipeline (like the one described above) and it worked just fine. I'm unsure what else I can do to try to this repository to attempt to get it to accept its data.

          Chris Franco added a comment -

          Ok markewaite I deleted a whole heap of branches and it appears to have gone away.

          I possibly think it's got to do with the branch name being too long and just windows/the plugin failing to deal with a character limit somewhere.

          I'm happy for you to cancel this but the issue will still potentially plague other windows users.

          Chris Franco added a comment - Ok markewaite I deleted a whole heap of branches and it appears to have gone away. I possibly think it's got to do with the branch name being too long and just windows/the plugin failing to deal with a character limit somewhere. I'm happy for you to cancel this but the issue will still potentially plague other windows users.

          Mark Waite added a comment -

          Thanks francommit for your diligent efforts to duplicate the problem. I have repositories with many, many branches (some with thousands), so I suspect that the problem is not in the count of branches, but one of those branch names may have exercised a bug in the code.

          I'll double check as time allows to see if I can find another way to see the problem.

          Mark Waite added a comment - Thanks francommit for your diligent efforts to duplicate the problem. I have repositories with many, many branches (some with thousands), so I suspect that the problem is not in the count of branches, but one of those branch names may have exercised a bug in the code. I'll double check as time allows to see if I can find another way to see the problem.

          Chris Franco added a comment -

          markewaite the issue came back. Turned out a fullstop in the name of a branch was making it go bananas.
          Deleted that branch with the fullstop and the problem went away.

          Hopefully you can replicate this yourself.

          Cheers.

          Chris Franco added a comment - markewaite the issue came back. Turned out a fullstop in the name of a branch was making it go bananas. Deleted that branch with the fullstop and the problem went away. Hopefully you can replicate this yourself. Cheers.

          Luke Last added a comment -

          I also ran into this problem

          I had this git option enabled: "Check out to specific local branch", in pipeline: extensions : [[$class: 'LocalBranch']]

          I solved the problem by deleting some branches. I'm not sure exactly what was going wrong but some index checking couldn't hurt.

          https://github.com/jenkinsci/git-client-plugin/blob/git-client-2.5.0/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java#L2043

          Luke Last added a comment - I also ran into this problem I had this git option enabled: "Check out to specific local branch", in pipeline: extensions : [ [$class: 'LocalBranch'] ] I solved the problem by deleting some branches. I'm not sure exactly what was going wrong but some index checking couldn't hurt. https://github.com/jenkinsci/git-client-plugin/blob/git-client-2.5.0/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java#L2043

          Mark Waite added a comment -

          lukelast I'm open to a pull request with one or more tests which show the problem, or even to a description of the specific branch names which cause the problem. I'm hesitant to insert bounds checking for a case that isn't duplicated by a test in the code.

          I'm not sure what francommit means as a "fullstop" in a branch name, though I assume he means ASCII 2E. If that's the case, then I don't see how that would cause a problem as a branch name, since '.' (ASCII 2E) is allowed as a character in a branch name.

          I could see that could being broken by a newline (or other end of line character) in the branch name. However, if a branch name includes some form of line break character (newline, carriage return, etc.) then it is not a valid git branch name, at least per the definition of the valid characters in the git man page.

          I've placed a test in my regression test kit which checks for ASCII 2E in a branch name. The test passes. Unfortunately, that means I still can't duplicate this problem.

          Mark Waite added a comment - lukelast I'm open to a pull request with one or more tests which show the problem, or even to a description of the specific branch names which cause the problem. I'm hesitant to insert bounds checking for a case that isn't duplicated by a test in the code. I'm not sure what francommit means as a "fullstop" in a branch name, though I assume he means ASCII 2E . If that's the case, then I don't see how that would cause a problem as a branch name, since '.' (ASCII 2E) is allowed as a character in a branch name. I could see that could being broken by a newline (or other end of line character) in the branch name. However, if a branch name includes some form of line break character (newline, carriage return, etc.) then it is not a valid git branch name , at least per the definition of the valid characters in the git man page . I've placed a test in my regression test kit which checks for ASCII 2E in a branch name. The test passes. Unfortunately, that means I still can't duplicate this problem.

          Chris Franco added a comment -

          lukelast the solution I also came across to fix the problem was deleting multiple branches until it worked.

          Chris Franco added a comment - lukelast the solution I also came across to fix the problem was deleting multiple branches until it worked.

          Mark Waite added a comment -

          Thanks to vadivel, I've finally understood the condition. lukelast was correct that bounds checking is what is needed. Sorry for my slow comprehension!

          The bounds checking which Luke recommended (along with an automated test) was provided about 3 weeks ago in a merge to the master branch. It will be included in the next release of the git client plugin.

          You can test an early build by downloading the latest artifact from the ci.jenkins.io build.

          Mark Waite added a comment - Thanks to vadivel , I've finally understood the condition. lukelast was correct that bounds checking is what is needed. Sorry for my slow comprehension! The bounds checking which Luke recommended (along with an automated test) was provided about 3 weeks ago in a merge to the master branch . It will be included in the next release of the git client plugin. You can test an early build by downloading the latest artifact from the ci.jenkins.io build .

          Mark Waite added a comment -

          Will be fixed with release of git client plugin 2.6.0

          Mark Waite added a comment - Will be fixed with release of git client plugin 2.6.0

          Mark Waite added a comment -

          Included in git client plugin 2.6.0, released 27 Oct 2017

          Mark Waite added a comment - Included in git client plugin 2.6.0, released 27 Oct 2017

            markewaite Mark Waite
            francommit Chris Franco
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: