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

NullPointerException during polling when using git inverse branch choosing strategy

    XMLWordPrintable

Details

    Description

      When using the git inverse branch choosing strategy (to exclude named branches) and polling a git repo, I see the following NullPointerException in the Git Polling Log:

      Mar 04, 2014 3:24:29 PM hudson.triggers.SCMTrigger$Runner runPolling
      SEVERE: Failed to record SCM polling for hudson.model.FreeStyleProject@4c06e5bd[job-name]
      java.lang.NullPointerException
              at hudson.plugins.git.util.InverseBuildChooser.getCandidateRevisions(InverseBuildChooser.java:45)
              at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:536)
              at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:455)
              at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
              at hudson.scm.SCM.poll(SCM.java:373)
              at hudson.model.AbstractProject.pollWithWorkspace(AbstractProject.java:1605)
              at hudson.model.AbstractProject._poll(AbstractProject.java:1575)
              at hudson.model.AbstractProject.poll(AbstractProject.java:1493)
              at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:462)
              at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:491)
              at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
              at java.util.concurrent.FutureTask.run(FutureTask.java:262)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              at java.lang.Thread.run(Thread.java:744)
      

      The project config is attached to this ticket:

      Unable to embed resource: config.xml of type application/xml

      I believe the cause is git plugin revision 4fc7f44. This NPE occurs in version 2.0.3 of the plugin but does not in version 2.0.1. (I have not tested 2.0.2, but I suspect it behaves the same as 2.0.3.)

      A possible workaround is to enable the "Force polling with workspace" option (see JENKINS-21264), but I have not confirmed if this works.

      Proposed fix in GitHub pull request #208.

      Attachments

        Activity

          abierbaum abierbaum added a comment -

          I am seeing the same thing on our servers after the latest update.

          abierbaum abierbaum added a comment - I am seeing the same thing on our servers after the latest update.
          samumbach Sam Umbach added a comment - - edited

          reply to abierbaum: Downgrading the git plugin to 2.0.1 should allow you to work around the issue until this is fixed: http://updates.jenkins-ci.org/download/plugins/git/2.0.1/git.hpi

          samumbach Sam Umbach added a comment - - edited reply to abierbaum : Downgrading the git plugin to 2.0.1 should allow you to work around the issue until this is fixed: http://updates.jenkins-ci.org/download/plugins/git/2.0.1/git.hpi
          markewaite Mark Waite added a comment - - edited

          I confirmed that the null pointer exception is still visible in the log as of git-client-plugin 1.8.0 and git-plugin 2.2.0.

          Started on Apr 4, 2014 2:49:22 PM
          Polling SCM changes on master
          Using strategy: Inverse
          [poll] Last Built Revision: Revision 79b09609c1304a3db713c6a4f3bab0d46c85db56 (origin/master)
          Fetching changes from the remote Git repositories
          Fetching upstream changes from git://github.com/jenkinsci/git-client-plugin.git
          Polling for changes in
          ERROR: Failed to record SCM polling for hudson.model.FreeStyleProject@38b93a92[JENKINS-22053-inverse-build-strategy-npe]
          java.lang.NullPointerException
          	at hudson.plugins.git.util.InverseBuildChooser.getCandidateRevisions(InverseBuildChooser.java:45)
          	at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:535)
          	at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:457)
          	at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
          	at hudson.scm.SCM.poll(SCM.java:373)
          	at hudson.model.AbstractProject.pollWithWorkspace(AbstractProject.java:1588)
          	at hudson.model.AbstractProject._poll(AbstractProject.java:1558)
          	at hudson.model.AbstractProject.poll(AbstractProject.java:1490)
          	at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:439)
          	at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:468)
          	at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
          	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
          	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          	at java.lang.Thread.run(Thread.java:744)
          

          The suggested work around (use a workspace for polling) did not seem to work for me.

          markewaite Mark Waite added a comment - - edited I confirmed that the null pointer exception is still visible in the log as of git-client-plugin 1.8.0 and git-plugin 2.2.0. Started on Apr 4, 2014 2:49:22 PM Polling SCM changes on master Using strategy: Inverse [poll] Last Built Revision: Revision 79b09609c1304a3db713c6a4f3bab0d46c85db56 (origin/master) Fetching changes from the remote Git repositories Fetching upstream changes from git://github.com/jenkinsci/git-client-plugin.git Polling for changes in ERROR: Failed to record SCM polling for hudson.model.FreeStyleProject@38b93a92[JENKINS-22053-inverse-build-strategy-npe] java.lang.NullPointerException at hudson.plugins.git.util.InverseBuildChooser.getCandidateRevisions(InverseBuildChooser.java:45) at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:535) at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:457) at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356) at hudson.scm.SCM.poll(SCM.java:373) at hudson.model.AbstractProject.pollWithWorkspace(AbstractProject.java:1588) at hudson.model.AbstractProject._poll(AbstractProject.java:1558) at hudson.model.AbstractProject.poll(AbstractProject.java:1490) at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:439) at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:468) at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) The suggested work around (use a workspace for polling) did not seem to work for me.

          Code changed in jenkins
          User: Mark Waite
          Path:
          src/main/java/hudson/plugins/git/util/InverseBuildChooser.java
          http://jenkins-ci.org/commit/git-plugin/8696bc00a1389cf5ccf6faf59d53a664e09832a7
          Log:
          Merge pull request #208 from sumbach/patch-1

          Use BuildChooserContext environment in InverseBuildChooser

          [Fixed JENKINS-22053]

          Compare: https://github.com/jenkinsci/git-plugin/compare/647249481eaf...8696bc00a138

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/hudson/plugins/git/util/InverseBuildChooser.java http://jenkins-ci.org/commit/git-plugin/8696bc00a1389cf5ccf6faf59d53a664e09832a7 Log: Merge pull request #208 from sumbach/patch-1 Use BuildChooserContext environment in InverseBuildChooser [Fixed JENKINS-22053] Compare: https://github.com/jenkinsci/git-plugin/compare/647249481eaf...8696bc00a138
          markewaite Mark Waite added a comment -

          Will be available in next git-plugin version after 2.2.0

          markewaite Mark Waite added a comment - Will be available in next git-plugin version after 2.2.0
          markewaite Mark Waite added a comment -

          Fixed in git-plugin 2.2.1 released 12 Apr 2014

          markewaite Mark Waite added a comment - Fixed in git-plugin 2.2.1 released 12 Apr 2014
          jperry Jay Perry added a comment -

          I currently running into this

          Started on Dec 22, 2014 12:59:00 PM
          Using strategy: Inverse
          [poll] Last Built Revision: Revision 87279712b25ea4b4fdefc47021c16f3a5108b448 (refs/remotes/origin/master)
          using GIT_SSH to set credentials 
           > git ls-remote -h git@bitbucket.org:company/myapp.git master # timeout=10
          FATAL: hudson.plugins.git.GitException: Error performing command: git ls-remote -h git@bitbucket.org:company/myapp.git master
          hudson.util.IOException2: hudson.plugins.git.GitException: Error performing command: git ls-remote -h git@bitbucket.org:company/myapp.git master
          	at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:518)
          	at hudson.scm.SCM.compareRemoteRevisionWith(SCM.java:384)
          	at hudson.scm.SCM.poll(SCM.java:401)
          	at hudson.model.AbstractProject._poll(AbstractProject.java:1429)
          

          I am using Jenkins 1.580.1 and git plugin 2.3.2. I do not get this when running master as it only happens with the Inverse setting. Please help as it prevents my builds from running. Thanks in advance.

          jperry Jay Perry added a comment - I currently running into this Started on Dec 22, 2014 12:59:00 PM Using strategy: Inverse [poll] Last Built Revision: Revision 87279712b25ea4b4fdefc47021c16f3a5108b448 (refs/remotes/origin/master) using GIT_SSH to set credentials > git ls-remote -h git@bitbucket.org:company/myapp.git master # timeout=10 FATAL: hudson.plugins.git.GitException: Error performing command: git ls-remote -h git@bitbucket.org:company/myapp.git master hudson.util.IOException2: hudson.plugins.git.GitException: Error performing command: git ls-remote -h git@bitbucket.org:company/myapp.git master at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:518) at hudson.scm.SCM.compareRemoteRevisionWith(SCM.java:384) at hudson.scm.SCM.poll(SCM.java:401) at hudson.model.AbstractProject._poll(AbstractProject.java:1429) I am using Jenkins 1.580.1 and git plugin 2.3.2. I do not get this when running master as it only happens with the Inverse setting. Please help as it prevents my builds from running. Thanks in advance.
          jperry Jay Perry added a comment -

          git client plugin is 1.13.0 too

          jperry Jay Perry added a comment - git client plugin is 1.13.0 too
          markewaite Mark Waite added a comment -

          jperry that is not a null pointer exception, so I think it belongs somewhere other than attached to this closed bug. I'd first suggest that you ask the Jenkins user mailing list for help. If they are unable to help, then you'll need to submit a new bug report. You might also try using https to access your bitbucket repository rather than ssh. There has been at least one case where a private bitbucket repository is accessible from the plugin by one protocol and not by another.

          markewaite Mark Waite added a comment - jperry that is not a null pointer exception, so I think it belongs somewhere other than attached to this closed bug. I'd first suggest that you ask the Jenkins user mailing list for help. If they are unable to help, then you'll need to submit a new bug report. You might also try using https to access your bitbucket repository rather than ssh. There has been at least one case where a private bitbucket repository is accessible from the plugin by one protocol and not by another.
          jperry Jay Perry added a comment -

          Thanks Mark. I'll try the mailing list.

          jperry Jay Perry added a comment - Thanks Mark. I'll try the mailing list.

          People

            ndeloof Nicolas De Loof
            samumbach Sam Umbach
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: