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

git-plugin happens to fail at printCommitMessageToLog

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • git-plugin
    • None
    • Jenkins 2.60.3
      Git-Plugin 3.5.1

      When I use github pullrequest builder to do CI with Jenkins, I met with following error.

      It seems this happen when a PR is merged into master branch while a build for another PR is running.

       

      16:45:47 Checking out Revision bf39dc9fd2ee5d9d97f11c3ed6b0de7da09eb0f1 (refs/remotes/origin/pr/447/merge)
      16:45:47 org.eclipse.jgit.errors.MissingObjectException: Missing unknown bf39dc9fd2ee5d9d97f11c3ed6b0de7da09eb0f1
      16:45:47 at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:158)
      16:45:47 at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:227)
      16:45:47 at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:859)
      16:45:47 at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:772)
      16:45:47 at hudson.plugins.git.util.RevCommitRepositoryCallback.invoke(RevCommitRepositoryCallback.java:25)
      16:45:47 at hudson.plugins.git.util.RevCommitRepositoryCallback.invoke(RevCommitRepositoryCallback.java:13)
      16:45:47 at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:29)
      16:45:47 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:71)
      16:45:47 at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source)
      16:45:47 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      16:45:47 at java.lang.reflect.Method.invoke(Method.java:498)
      16:45:47 at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:895)
      16:45:47 at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:870)
      16:45:47 at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:829)
      16:45:47 at hudson.remoting.UserRequest.perform(UserRequest.java:153)
      16:45:47 at hudson.remoting.UserRequest.perform(UserRequest.java:50)
      16:45:47 at hudson.remoting.Request$2.run(Request.java:336)
      16:45:47 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
      16:45:47 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      16:45:47 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      16:45:47 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      16:45:47 at java.lang.Thread.run(Thread.java:748)
      16:45:47 at ......remote call to sakura11(Native Method)
      16:45:47 at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545)
      16:45:47 at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
      16:45:47 at hudson.remoting.Channel.call(Channel.java:830)
      16:45:47 at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:257)
      16:45:47 at com.sun.proxy.$Proxy70.withRepository(Unknown Source)
      16:45:47 at org.jenkinsci.plugins.gitclient.RemoteGitImpl.withRepository(RemoteGitImpl.java:235)
      16:45:47 at hudson.plugins.git.GitSCM.printCommitMessageToLog(GitSCM.java:1195)
      16:45:47 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1159)

       

      Under investigation, I found that this actually happens at git-plugin printCommitMessageToLog(). 

      https://github.com/jenkinsci/git-plugin/blob/a85ede15b2f2c1d667dfe35a8848722a4aa49b45/src/main/java/hudson/plugins/git/GitSCM.java#L1159

        

      private void printCommitMessageToLog(TaskListener listener, GitClient git, final Build revToBuild)
      throws IOException {
          try {
              RevCommit commit = git.withRepository(new RevCommitRepositoryCallback(revToBuild));
              listener.getLogger().println("Commit message: \"" + commit.getShortMessage() + "\"");
          } catch (InterruptedException e) {
              e.printStackTrace(listener.error("Unable to retrieve commit message"));
          }
      }
      

       

      It seemed that it failed at `git.withRepository(new RevCommitRepositoryCallback(revToBuild));`, so actually failing with org.eclipse.jgit. But, I am not sure which git-plugin or jgit is responsible for this.

       

            Unassigned Unassigned
            sonots2nd Naotoshi Seo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: