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

NPE in hudson.plugins.mercurial.MercurialSCM.compareRemoteRevisionWith

      When polling I get this error in the log. It repeats for a couple of days now. I don't which of my projects gives this, but it polls every half an hour and gives this NPE.

      May 1, 2012 4:00:46 PM hudson.triggers.SCMTrigger$Runner runPolling
      SEVERE: Failed to record SCM polling
      java.lang.NullPointerException
      at hudson.plugins.mercurial.MercurialSCM.compareRemoteRevisionWith(MercurialSCM.java:241)
      at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
      at hudson.scm.SCM.poll(SCM.java:373)
      at hudson.model.AbstractProject.poll(AbstractProject.java:1323)
      at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:420)
      at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:449)
      at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

          [JENKINS-13669] NPE in hudson.plugins.mercurial.MercurialSCM.compareRemoteRevisionWith

          Jesse Glick added a comment -

          Interesting... are there any errors noted in your polling log?

          Jesse Glick added a comment - Interesting... are there any errors noted in your polling log?

          Joe Kearney added a comment -

          I see the same issue. There are no other errors in the polling logs - it doesn't get very far. I also have caching but not sharing enabled.

          Started on 13-Jun-2012 12:03:19
          ERROR: Failed to record SCM polling for hudson.model.FreeStyleProject@4b6e3f87[prophet]
          java.lang.NullPointerException
          at hudson.plugins.mercurial.MercurialSCM.compareRemoteRevisionWith(MercurialSCM.java:242)
          at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
          at hudson.scm.SCM.poll(SCM.java:373)
          [rest of stack trace]

          Joe Kearney added a comment - I see the same issue. There are no other errors in the polling logs - it doesn't get very far. I also have caching but not sharing enabled. Started on 13-Jun-2012 12:03:19 ERROR: Failed to record SCM polling for hudson.model.FreeStyleProject@4b6e3f87 [prophet] java.lang.NullPointerException at hudson.plugins.mercurial.MercurialSCM.compareRemoteRevisionWith(MercurialSCM.java:242) at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356) at hudson.scm.SCM.poll(SCM.java:373) [rest of stack trace]

          Marc Günther added a comment -

          Joe, regarding your comment to JENKINS-10880, the fix for the Git NPE was in the Git Plugin itself.

          This one is something different:

                      PossiblyCachedRepo possiblyCachedRepo = cachedSource(Hudson.getInstance(), launcher, listener, true);
                      FilePath repositoryCache = new FilePath(new File(possiblyCachedRepo.getRepoLocation()));
          

          The possibleCachedRepo seems to be null, which is perfectly valid, if you look at the cachedSource() method. Maybe this is also triggered by an "inconsistent" config (one edited manually) like in the Git case?

          Marc Günther added a comment - Joe, regarding your comment to JENKINS-10880 , the fix for the Git NPE was in the Git Plugin itself. This one is something different: PossiblyCachedRepo possiblyCachedRepo = cachedSource(Hudson.getInstance(), launcher, listener, true ); FilePath repositoryCache = new FilePath( new File(possiblyCachedRepo.getRepoLocation())); The possibleCachedRepo seems to be null, which is perfectly valid, if you look at the cachedSource() method. Maybe this is also triggered by an "inconsistent" config (one edited manually) like in the Git case?

          Joe Kearney added a comment -

          I haven't manually edited any config, this is all through the web interface.

          Is the problem here that the null should be handled when returned from cachedSource() or that the possiblyCachedRepo should not be null with caching enabled?

          Joe Kearney added a comment - I haven't manually edited any config, this is all through the web interface. Is the problem here that the null should be handled when returned from cachedSource() or that the possiblyCachedRepo should not be null with caching enabled?

          Marc Günther added a comment -

          Sorry, from the code I would guess that the null should be handled by the caller (the logic which decides if cachedSource() returns null looks very different from the !requiresWorkspaceForPolling() one. But this needs to be answered by someone who knows this stuff, I don't even know what cached or shared means

          Marc Günther added a comment - Sorry, from the code I would guess that the null should be handled by the caller (the logic which decides if cachedSource() returns null looks very different from the !requiresWorkspaceForPolling() one. But this needs to be answered by someone who knows this stuff, I don't even know what cached or shared means

          Marc Swingler added a comment - - edited

          I'm at version 1.44 of the plugin and I'm getting the same error in my Mercurial Polling logs:

          NPE
          Started on Mar 6, 2013 10:55:30 AM
          Acquired master cache lock.
          [...] $ "D:\Program Files\Mercurial\hg.exe" pull
          warning: ... certificate with fingerprint ... not verified (check hostfingerprints or web.cacerts config setting)
          pulling from ...
          searching for changes
          no changes found
          ERROR: Failed to update D:\.jenkins\hgcache\...
          Master cache lock released.
          ERROR: Failed to use repository cache for ...
          ERROR: Failed to record SCM polling for hudson.maven.MavenModuleSet@...[...]
          java.lang.NullPointerException
          	at hudson.plugins.mercurial.MercurialSCM.compareRemoteRevisionWith(MercurialSCM.java:242)
          	at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
          	at hudson.scm.SCM.poll(SCM.java:373)
          	at hudson.model.AbstractProject._poll(AbstractProject.java:1493)
          	at hudson.model.AbstractProject.poll(AbstractProject.java:1410)
          	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(Unknown Source)
          	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
          	at java.util.concurrent.FutureTask.run(Unknown Source)
          	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          	at java.lang.Thread.run(Unknown Source)
          

          Marc Swingler added a comment - - edited I'm at version 1.44 of the plugin and I'm getting the same error in my Mercurial Polling logs: NPE Started on Mar 6, 2013 10:55:30 AM Acquired master cache lock. [...] $ "D:\Program Files\Mercurial\hg.exe" pull warning: ... certificate with fingerprint ... not verified (check hostfingerprints or web.cacerts config setting) pulling from ... searching for changes no changes found ERROR: Failed to update D:\.jenkins\hgcache\... Master cache lock released. ERROR: Failed to use repository cache for ... ERROR: Failed to record SCM polling for hudson.maven.MavenModuleSet@...[...] java.lang.NullPointerException at hudson.plugins.mercurial.MercurialSCM.compareRemoteRevisionWith(MercurialSCM.java:242) at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356) at hudson.scm.SCM.poll(SCM.java:373) at hudson.model.AbstractProject._poll(AbstractProject.java:1493) at hudson.model.AbstractProject.poll(AbstractProject.java:1410) 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(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang. Thread .run(Unknown Source)

          Jesse Glick added a comment -

          Code in question introduced in:

          commit bd53013835c998e2b9bc81d8de8bd7581f7d0e8a
          Author: Willem Verstraeten <willem.verstraeten@gmail.com>
          Date:   Thu Jan 5 18:49:27 2012 +0100
          
              Implement requiresWorkspaceForPolling
              
              When using caching, all poll operations can be performed on the central cache, so no workspace is necessary
          

          Indeed it is legitimate for possiblyCachedRepo to be null sometimes.

          My first inclination would be to then skip the next two lines and continue with workspace-based polling:

          if (possiblyCachedRepo != null) {
              FilePath repositoryCache = new FilePath(new File(possiblyCachedRepo.getRepoLocation()));
              return compare(launcher, listener, baseline, output, Hudson.getInstance(), repositoryCache);
          }
          

          I am not sure however what Jenkins will do if you first claimed you supported workspaceless polling but then when asked to poll in fact demand a workspace! The Javadoc for SCM is unclear on this point. Worth trying I guess.

          Jesse Glick added a comment - Code in question introduced in: commit bd53013835c998e2b9bc81d8de8bd7581f7d0e8a Author: Willem Verstraeten <willem.verstraeten@gmail.com> Date: Thu Jan 5 18:49:27 2012 +0100 Implement requiresWorkspaceForPolling When using caching, all poll operations can be performed on the central cache, so no workspace is necessary Indeed it is legitimate for possiblyCachedRepo to be null sometimes. My first inclination would be to then skip the next two lines and continue with workspace-based polling: if (possiblyCachedRepo != null ) { FilePath repositoryCache = new FilePath( new File(possiblyCachedRepo.getRepoLocation())); return compare(launcher, listener, baseline, output, Hudson.getInstance(), repositoryCache); } I am not sure however what Jenkins will do if you first claimed you supported workspaceless polling but then when asked to poll in fact demand a workspace ! The Javadoc for SCM is unclear on this point. Worth trying I guess.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/hudson/plugins/mercurial/MercurialSCM.java
          http://jenkins-ci.org/commit/mercurial-plugin/8f3d32c85266e5bb34fc4337fb7299e59738061a
          Log:
          [FIXED JENKINS-13669] NPE when possiblyCachedRepo == null.


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/hudson/plugins/mercurial/MercurialSCM.java http://jenkins-ci.org/commit/mercurial-plugin/8f3d32c85266e5bb34fc4337fb7299e59738061a Log: [FIXED JENKINS-13669] NPE when possiblyCachedRepo == null. – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .

          If the possiblyCachedRepo is null, it means there was an earler error updating or cloning the cache. The polling shouldn't try to continue in that case, but throw an exception.

          For instance:

          if (!requiresWorkspaceForPolling()) {
              launcher = Hudson.getInstance().createLauncher(listener);
              PossiblyCachedRepo possiblyCachedRepo = cachedSource(Hudson.getInstance(), launcher, listener, true);
              if (possiblyCachedRepo == null) {
                  throw new IOException("Could not use cache to poll for changes. See error messages above for more details");
              }
              FilePath repositoryCache = new FilePath(new File(possiblyCachedRepo.getRepoLocation()));
              return compare(launcher, listener, baseline, output, Hudson.getInstance(), repositoryCache);
          }
          

          Willem Verstraeten added a comment - If the possiblyCachedRepo is null, it means there was an earler error updating or cloning the cache. The polling shouldn't try to continue in that case, but throw an exception. For instance: if (!requiresWorkspaceForPolling()) { launcher = Hudson.getInstance().createLauncher(listener); PossiblyCachedRepo possiblyCachedRepo = cachedSource(Hudson.getInstance(), launcher, listener, true ); if (possiblyCachedRepo == null ) { throw new IOException( "Could not use cache to poll for changes. See error messages above for more details" ); } FilePath repositoryCache = new FilePath( new File(possiblyCachedRepo.getRepoLocation())); return compare(launcher, listener, baseline, output, Hudson.getInstance(), repositoryCache); }

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/hudson/plugins/mercurial/MercurialSCM.java
          http://jenkins-ci.org/commit/mercurial-plugin/1576c70a2c753480857391757b8c059b39fda880
          Log:
          JENKINS-13669 willemv advocates simply failing the polling operation if possiblyCachedRepo is null.


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/hudson/plugins/mercurial/MercurialSCM.java http://jenkins-ci.org/commit/mercurial-plugin/1576c70a2c753480857391757b8c059b39fda880 Log: JENKINS-13669 willemv advocates simply failing the polling operation if possiblyCachedRepo is null. – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .

            willemv Willem Verstraeten
            javakoe Ronald Klop
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: