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

During git checkout, jgit core crashes on a stackoverflow on an infinite openPackedFromSelfOrAlternate loop.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • git-client-plugin
    • None

      We are having intermittent problems checkout out some of our repositories. We're not entirely sure what happens, but it seems that when a particular commit is being present in the branch history, the checkout will fail in the following way (redacted):

      ---8<---------
      (initialisation)
      ...
      (checkout of other repositories)
      ...
      Cloning the remote Git repository
      Cloning repository git+ssh://git@git.company.com/reponame
      > C:\Program Files\Git\cmd\git.exe init ...\workspace\product\git\reponame # timeout=10
      Fetching upstream changes from git+ssh://git@git.company.com/reponame
      > C:\Program Files\Git\cmd\git.exe --version # timeout=10
      using GIT_SSH to set credentials 
       > C:\Program Files\Git\cmd\git.exe fetch --tags --progress git+ssh://git@git.company.com/reponame +refs/heads/*:refs/remotes/origin/* # timeout=20
      > C:\Program Files\Git\cmd\git.exe config remote.origin.url git+ssh://git@git.company.com/reponame # timeout=10
      > C:\Program Files\Git\cmd\git.exe config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
      > C:\Program Files\Git\cmd\git.exe config remote.origin.url git+ssh://git@git.company.com/reponame # timeout=10
      Fetching upstream changes from git+ssh://git@git.company.com/reponame
      using GIT_SSH to set credentials 
       > C:\Program Files\Git\cmd\git.exe fetch --tags --progress git+ssh://git@git.company.com/reponame +refs/heads/*:refs/remotes/origin/* # timeout=20
      > C:\Program Files\Git\cmd\git.exe rev-parse "origin/bugfix-branch^\{commit}" # timeout=10
      Checking out Revision 721397010a24a218e8619e07645d99afe0fabb52 (origin/bugfix-branch)
      java.lang.StackOverflowError
                      at java.lang.ThreadLocal.get(Unknown Source)
                      at sun.nio.fs.NativeBuffers.getNativeBufferFromCache(Unknown Source)
                      at sun.nio.fs.WindowsNativeDispatcher.asNativeBuffer(Unknown Source)
                      at sun.nio.fs.WindowsNativeDispatcher.GetFileAttributesEx(Unknown Source)
                      at sun.nio.fs.WindowsFileAttributes.get(Unknown Source)
                      at sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(Unknown Source)
                      at sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(Unknown Source)
                      at sun.nio.fs.WindowsFileSystemProvider.readAttributes(Unknown Source)
                      at java.nio.file.Files.readAttributes(Unknown Source)
                      at java.nio.file.Files.getLastModifiedTime(Unknown Source)
                      at org.eclipse.jgit.util.FileUtils.lastModified(FileUtils.java:563)
                      at org.eclipse.jgit.util.FS.lastModified(FS.java:299)
                      at org.eclipse.jgit.internal.storage.file.FileSnapshot.isModified(FileSnapshot.java:164)
                      at org.eclipse.jgit.internal.storage.file.ObjectDirectory.searchPacksAgain(ObjectDirectory.java:688)
                      at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedObject(ObjectDirectory.java:435)
                      at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:390)
                      at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:394)
                      at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:394)
                      at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:394)
                      at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:394)
                      at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:394)
                      ... (snip 999 repeats)
                      at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:394)
                      at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:394)
                      at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:394)
                      at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:394)
                      at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:394)
                      at ......remote call to Channel to /<ip-address>(Native Method)
                      at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1554)
                      at hudson.remoting.UserResponse.retrieve(UserRequest.java:281)
                      at hudson.remoting.Channel.call(Channel.java:839)
      Caused: java.io.IOException: Remote call on Channel to /<ip-address> failed
                      at hudson.remoting.Channel.call(Channel.java:847)
                      at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:257)
                      at com.sun.proxy.$Proxy97.withRepository(Unknown Source)
                      at org.jenkinsci.plugins.gitclient.RemoteGitImpl.withRepository(RemoteGitImpl.java:235)
                      at hudson.plugins.git.GitSCM.printCommitMessageToLog(GitSCM.java:1195)
                      at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1159)
                      at org.jenkinsci.plugins.multiplescms.MultiSCM.checkout(MultiSCM.java:143)
                      at hudson.scm.SCM.checkout(SCM.java:495)
                      at hudson.model.AbstractProject.checkout(AbstractProject.java:1212)
                      at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:560)
                      at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
                      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:485)
                      at hudson.model.Run.execute(Run.java:1737)
                      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
                      at hudson.model.ResourceController.execute(ResourceController.java:97)
                      at hudson.model.Executor.run(Executor.java:419)
      Sending e-mails to: developers@company.com
      [WS-CLEANUP] Deleting project workspace...[WS-CLEANUP] done
      Finished: FAILURE
      --->8---------
      

      So far the only way we've found to resolve the problem is to omit (note: not revert, that does not help) the commit in question from the branch's history. However, this commit contains a critical bug fix and is required to be released on this branch, so simply leaving it out is not an option for us. Moreover, we are worried that this problem may start cropping up on other branches too.

      We suspect that that the problem is with the version of JGit Core that is used by the Jenkins Git client plugin. Looking at the changes to JGit Core, we see the following change which fixes something which sounds suspiciously like the problem we are currently experiencing:

      However, we don't really see any 'alternates' files in the repository's .git folder so we're not 100% certain that this is really the problem, although we admit that we are not familiar with Git internals.

      PS. we found a workaround, we made a new reference checkout on the build machine with the problem and it the crashes have vanished. We do still have the old one so expect to be able to reproduce again.

            Unassigned Unassigned
            wilcobt Wilco Belgraver Thissen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: