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

Null pointer exception in JGit pre-build merge

      When attempting a pre-build merge with JGit a null pointer exception is reported. The stack trace is:

      java.lang.NullPointerException
      	at hudson.plugins.git.util.GitUtils.getRevisionForSHA1(GitUtils.java:166)
      	at hudson.plugins.git.extensions.impl.PreBuildMerge.decorateRevisionToBuild(PreBuildMerge.java:119)
      	at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1058)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1151)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      

      Refer to my jenkins-bugs test repository for the details.

      The failure is specific to the JGit implementation. It was not visible in the command line git implementation.

          [JENKINS-57205] Null pointer exception in JGit pre-build merge

          Mark Waite created issue -
          Mark Waite made changes -
          Description Original:
          While testing the fix that [~jglick] has provided for git plugin 4.0 and git plugin 3.10, I found a null pointer exception that I need to investigate further when using JGit as the git implementation. The stack trace was:

          {noformat}
          java.lang.NullPointerException
          at hudson.plugins.git.util.GitUtils.getRevisionForSHA1(GitUtils.java:166)
          at hudson.plugins.git.extensions.impl.PreBuildMerge.decorateRevisionToBuild(PreBuildMerge.java:119)
          at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1058)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1151)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
          at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
          at java.base/java.lang.Thread.run(Thread.java:834)
          {noformat}

          I'll refer to [my jenkins-bugs test repository|https://github.com/MarkEWaite/jenkins-bugs/tree/JENKINS-51638] for the details.
          New: While testing the fix that [~jglick] has provided for JENKINS-51638 in git plugin 4.0 and git plugin 3.10, I found a null pointer exceptionwhen using JGit as the git implementation. The stack trace was:

          {noformat}
          java.lang.NullPointerException
          at hudson.plugins.git.util.GitUtils.getRevisionForSHA1(GitUtils.java:166)
          at hudson.plugins.git.extensions.impl.PreBuildMerge.decorateRevisionToBuild(PreBuildMerge.java:119)
          at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1058)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1151)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
          at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
          at java.base/java.lang.Thread.run(Thread.java:834)
          {noformat}

          Refer to [my jenkins-bugs test repository|https://github.com/MarkEWaite/jenkins-bugs/tree/JENKINS-51638] for the details.
          Mark Waite made changes -
          Description Original: While testing the fix that [~jglick] has provided for JENKINS-51638 in git plugin 4.0 and git plugin 3.10, I found a null pointer exceptionwhen using JGit as the git implementation. The stack trace was:

          {noformat}
          java.lang.NullPointerException
          at hudson.plugins.git.util.GitUtils.getRevisionForSHA1(GitUtils.java:166)
          at hudson.plugins.git.extensions.impl.PreBuildMerge.decorateRevisionToBuild(PreBuildMerge.java:119)
          at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1058)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1151)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
          at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
          at java.base/java.lang.Thread.run(Thread.java:834)
          {noformat}

          Refer to [my jenkins-bugs test repository|https://github.com/MarkEWaite/jenkins-bugs/tree/JENKINS-51638] for the details.
          New: While testing the fix that [~jglick] has provided for JENKINS-51638 in git plugin 4.0 and git plugin 3.10, I found a null pointer exceptionwhen using JGit as the git implementation. The stack trace was:

          {noformat}
          java.lang.NullPointerException
          at hudson.plugins.git.util.GitUtils.getRevisionForSHA1(GitUtils.java:166)
          at hudson.plugins.git.extensions.impl.PreBuildMerge.decorateRevisionToBuild(PreBuildMerge.java:119)
          at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1058)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1151)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
          at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
          at java.base/java.lang.Thread.run(Thread.java:834)
          {noformat}

          Refer to [my jenkins-bugs test repository|https://github.com/MarkEWaite/jenkins-bugs/tree/JENKINS-51638] for the details.

          The failure seemed to be intermittent and limited to the JGit implementation. It was not visible in the command line git implementation.
          Mark Waite made changes -
          Link New: This issue is related to JENKINS-51638 [ JENKINS-51638 ]

          Jesse Glick added a comment -

          Apparently some Revision.getSha1() is returning null. This field has unclear nullability; various methods in Revision imply that it may be null, though I am not sure what that would mean. Seems to date at least to this commit but may be older. Suggest making it be @Nonnull, enforced at runtime, and if there any resulting test failures then track down the root issue.

          Jesse Glick added a comment - Apparently some Revision.getSha1() is returning null. This field has unclear nullability; various methods in Revision imply that it may be null, though I am not sure what that would mean. Seems to date at least to this commit but may be older. Suggest making it be @Nonnull , enforced at runtime, and if there any resulting test failures then track down the root issue.
          Mark Waite made changes -
          Description Original: While testing the fix that [~jglick] has provided for JENKINS-51638 in git plugin 4.0 and git plugin 3.10, I found a null pointer exceptionwhen using JGit as the git implementation. The stack trace was:

          {noformat}
          java.lang.NullPointerException
          at hudson.plugins.git.util.GitUtils.getRevisionForSHA1(GitUtils.java:166)
          at hudson.plugins.git.extensions.impl.PreBuildMerge.decorateRevisionToBuild(PreBuildMerge.java:119)
          at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1058)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1151)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
          at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
          at java.base/java.lang.Thread.run(Thread.java:834)
          {noformat}

          Refer to [my jenkins-bugs test repository|https://github.com/MarkEWaite/jenkins-bugs/tree/JENKINS-51638] for the details.

          The failure seemed to be intermittent and limited to the JGit implementation. It was not visible in the command line git implementation.
          New: While testing the fix that [~jglick] has provided for JENKINS-51638 in git plugin 4.0 and git plugin 3.10, I found a null pointer exception when using JGit as the git implementation. The stack trace was:

          {noformat}
          java.lang.NullPointerException
          at hudson.plugins.git.util.GitUtils.getRevisionForSHA1(GitUtils.java:166)
          at hudson.plugins.git.extensions.impl.PreBuildMerge.decorateRevisionToBuild(PreBuildMerge.java:119)
          at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1058)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1151)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
          at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
          at java.base/java.lang.Thread.run(Thread.java:834)
          {noformat}

          Refer to [my jenkins-bugs test repository|https://github.com/MarkEWaite/jenkins-bugs/tree/JENKINS-51638] for the details.

          The failure seemed to be intermittent and limited to the JGit implementation. It was not visible in the command line git implementation.

          Mark Waite added a comment -

          See the JENKINS-59008 verify job for another example of the null pointer exception in the JGit pre-build merge.

          Mark Waite added a comment - See the JENKINS-59008 verify job for another example of the null pointer exception in the JGit pre-build merge.
          Mark Waite made changes -
          Description Original: While testing the fix that [~jglick] has provided for JENKINS-51638 in git plugin 4.0 and git plugin 3.10, I found a null pointer exception when using JGit as the git implementation. The stack trace was:

          {noformat}
          java.lang.NullPointerException
          at hudson.plugins.git.util.GitUtils.getRevisionForSHA1(GitUtils.java:166)
          at hudson.plugins.git.extensions.impl.PreBuildMerge.decorateRevisionToBuild(PreBuildMerge.java:119)
          at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1058)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1151)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
          at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
          at java.base/java.lang.Thread.run(Thread.java:834)
          {noformat}

          Refer to [my jenkins-bugs test repository|https://github.com/MarkEWaite/jenkins-bugs/tree/JENKINS-51638] for the details.

          The failure seemed to be intermittent and limited to the JGit implementation. It was not visible in the command line git implementation.
          New: When attempting a pre-build merge with JGit a null pointer exception is reported. The stack trace is:

          {noformat}
          java.lang.NullPointerException
          at hudson.plugins.git.util.GitUtils.getRevisionForSHA1(GitUtils.java:166)
          at hudson.plugins.git.extensions.impl.PreBuildMerge.decorateRevisionToBuild(PreBuildMerge.java:119)
          at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1058)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1151)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
          at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
          at java.base/java.lang.Thread.run(Thread.java:834)
          {noformat}

          Refer to [my jenkins-bugs test repository|https://github.com/MarkEWaite/jenkins-bugs/tree/JENKINS-51638] for the details.

          The failure is specific to the JGit implementation. It was not visible in the command line git implementation.
          Mark Waite made changes -
          Link Original: This issue is related to JENKINS-51638 [ JENKINS-51638 ]

          Roland Asmann added a comment -

           I have this issue on 3 of 5 jobs... I just don't understand why it sometimes works and sometimes it doesn't...

          Any chance we can get this fixed in the next release?

          Roland Asmann added a comment -  I have this issue on 3 of 5 jobs... I just don't understand why it sometimes works and sometimes it doesn't... Any chance we can get this fixed in the next release?

            brianeray Brian Ray
            markewaite Mark Waite
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: