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

Git plugin fails on remote Poll

    XMLWordPrintable

Details

    Description

      If you enable remote polling in the Git Plugin, the project will never poll successfully, and stops other projects polling as well.

      In GitSCM, requiresWorkspaceForPolling() returns false if remotePoll is enabled.
      https://github.com/jenkinsci/git-plugin/blob/git-1.1.12/src/main/java/hudson/plugins/git/GitSCM.java#L582

      This mean that in the jenkins-core AbstractProject (at least on the LTS branch), a null value is passed in for the workspace parameter to SCM.poll()
      https://github.com/jenkinsci/jenkins/blob/jenkins-1.409.1/core/src/main/java/hudson/model/AbstractProject.java#L1305

      This ends up in 'compareRemoteRevisionWith' back in GitSCM. At line 651, the call to 'workingDirectory(workspace)' returns null - because null was passed in as a param from AbstractProject. This means that at line 657, the call to !!workingDirectory.exists() results in a null pointer.

      Suggested fix: remove the remotePoll, or make it require a workspace to do the polling.

      Stacktrace:
      Sep 2, 2011 2:41:50 PM hudson.triggers.SCMTrigger$Runner runPolling
      SEVERE: Failed to record SCM polling
      java.lang.NullPointerException
      at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:657)
      at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:354)
      at hudson.scm.SCM.poll(SCM.java:371)
      at hudson.model.AbstractProject.poll(AbstractProject.java:1305)
      at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:420)
      at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:449)
      at hudson.triggers.SCMTrigger.run(SCMTrigger.java:103)
      at hudson.triggers.SCMTrigger.run(SCMTrigger.java:83)
      at hudson.triggers.Trigger$1.run(Trigger.java:229)
      at hudson.DependencyRunner.run(DependencyRunner.java:73)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)

      Attachments

        Issue Links

          Activity

            marc_guenther Marc Günther added a comment -

            This only happens when you manually edit the config.xml files.

            If you want to enable Fast Remote Polling, you can have only one branch, one repository, and you can not use any excluded regions, excluded users or submodules. Of course this is not documented anywhere.

            Furthermore, if you DO enable it, and these requirements are not met, Jenkins silently disables it again, without telling you anything about it.

            BUT, if you enable it manually by editing the config.xml, then Jenkins will NOT disable it. And then if you have more than one branch, the config will be in an inconsistent state, which Jenkins is not able to handle.

            marc_guenther Marc Günther added a comment - This only happens when you manually edit the config.xml files. If you want to enable Fast Remote Polling, you can have only one branch, one repository, and you can not use any excluded regions, excluded users or submodules. Of course this is not documented anywhere. Furthermore, if you DO enable it, and these requirements are not met, Jenkins silently disables it again, without telling you anything about it. BUT, if you enable it manually by editing the config.xml, then Jenkins will NOT disable it. And then if you have more than one branch, the config will be in an inconsistent state, which Jenkins is not able to handle.
            marc_guenther Marc Günther added a comment - Fix available here: https://github.com/jenkinsci/git-plugin/pull/61

            Code changed in jenkins
            User: Marc Guenther
            Path:
            src/main/webapp/help-fastremote.html
            http://jenkins-ci.org/commit/git-plugin/0fbdcff9be476f9a247da3fc2fa38e0bf8d0e02f
            Log:
            JENKINS-10880 add some help text about the limitations of fast remote polling

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Marc Guenther Path: src/main/webapp/help-fastremote.html http://jenkins-ci.org/commit/git-plugin/0fbdcff9be476f9a247da3fc2fa38e0bf8d0e02f Log: JENKINS-10880 add some help text about the limitations of fast remote polling

            Code changed in jenkins
            User: Marc Guenther
            Path:
            src/main/java/hudson/plugins/git/GitSCM.java
            http://jenkins-ci.org/commit/git-plugin/edf09052d200bab3e83cf59a2f52d8cade99e9c9
            Log:
            [FIXED JENKINS-10880] check if the workspace is null when fast remote polling is enabled with multiple branches

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Marc Guenther Path: src/main/java/hudson/plugins/git/GitSCM.java http://jenkins-ci.org/commit/git-plugin/edf09052d200bab3e83cf59a2f52d8cade99e9c9 Log: [FIXED JENKINS-10880] check if the workspace is null when fast remote polling is enabled with multiple branches

            Code changed in jenkins
            User: Nicolas De loof
            Path:
            src/main/java/hudson/plugins/git/GitSCM.java
            src/main/webapp/help-fastremote.html
            http://jenkins-ci.org/commit/git-plugin/11bef7f5da0d6a2f0fa6bbf6c262325bf4efea4a
            Log:
            Merge pull request #61 from marc-guenther/master

            [FIXED JENKINS-10880] check if the workspace is null when fast remote polling is enabled with multiple branches

            Compare: https://github.com/jenkinsci/git-plugin/compare/f9f239a...11bef7f

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De loof Path: src/main/java/hudson/plugins/git/GitSCM.java src/main/webapp/help-fastremote.html http://jenkins-ci.org/commit/git-plugin/11bef7f5da0d6a2f0fa6bbf6c262325bf4efea4a Log: Merge pull request #61 from marc-guenther/master [FIXED JENKINS-10880] check if the workspace is null when fast remote polling is enabled with multiple branches Compare: https://github.com/jenkinsci/git-plugin/compare/f9f239a...11bef7f
            dogfood dogfood added a comment -

            Integrated in plugins_git-plugin #314

            Result = UNSTABLE

            dogfood dogfood added a comment - Integrated in plugins_git-plugin #314 Result = UNSTABLE
            marc_guenther Marc Günther added a comment -

            Still does not work. There is now another NPE later on in the code.

            SEVERE: Failed to record SCM polling
            java.lang.NullPointerException
            	at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:677)
                    ...
            

            Line 677 reads:

             if(buildData.lastBuild.getRevision().getSha1String().equals(headRevision)) {
            

            The funny thing is, that buildData.lastBuild is already tested against null further up, but only to do some log output. So it IS expected that this can be null, but still it's used here without any checking.

            marc_guenther Marc Günther added a comment - Still does not work. There is now another NPE later on in the code. SEVERE: Failed to record SCM polling java.lang.NullPointerException at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:677) ... Line 677 reads: if (buildData.lastBuild.getRevision().getSha1String().equals(headRevision)) { The funny thing is, that buildData.lastBuild is already tested against null further up, but only to do some log output. So it IS expected that this can be null , but still it's used here without any checking.
            marc_guenther Marc Günther added a comment - fix available here: https://github.com/jenkinsci/git-plugin/pull/65

            Code changed in jenkins
            User: Marc Guenther
            Path:
            core/src/main/java/hudson/triggers/SCMTrigger.java
            http://jenkins-ci.org/commit/jenkins/7066daf3ee9d75d427918b068293e5b4ebbc98cd
            Log:
            JENKINS-10880 output the job when polling fails

            When polling fails for some reason, it simply outputs
            "Failed to record SCM polling" which is not very helpful.
            At least add the job, like it is done already in the thread name:
            "Failed to record SCM polling for "+job

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Marc Guenther Path: core/src/main/java/hudson/triggers/SCMTrigger.java http://jenkins-ci.org/commit/jenkins/7066daf3ee9d75d427918b068293e5b4ebbc98cd Log: JENKINS-10880 output the job when polling fails When polling fails for some reason, it simply outputs "Failed to record SCM polling" which is not very helpful. At least add the job, like it is done already in the thread name: "Failed to record SCM polling for "+job

            Code changed in jenkins
            User: Seiji Sogabe
            Path:
            core/src/main/java/hudson/triggers/SCMTrigger.java
            http://jenkins-ci.org/commit/jenkins/f338e21b4f00d66f14b83af3f0c91a9ac15d8513
            Log:
            Merge pull request #433 from marc-guenther/jenkins-10880

            JENKINS-10880 output the job when polling fails

            Compare: https://github.com/jenkinsci/jenkins/compare/d98926a...f338e21

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Seiji Sogabe Path: core/src/main/java/hudson/triggers/SCMTrigger.java http://jenkins-ci.org/commit/jenkins/f338e21b4f00d66f14b83af3f0c91a9ac15d8513 Log: Merge pull request #433 from marc-guenther/jenkins-10880 JENKINS-10880 output the job when polling fails Compare: https://github.com/jenkinsci/jenkins/compare/d98926a...f338e21
            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #1668
            JENKINS-10880 output the job when polling fails (Revision 7066daf3ee9d75d427918b068293e5b4ebbc98cd)

            Result = SUCCESS
            mguenther : 7066daf3ee9d75d427918b068293e5b4ebbc98cd
            Files :

            • core/src/main/java/hudson/triggers/SCMTrigger.java
            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #1668 JENKINS-10880 output the job when polling fails (Revision 7066daf3ee9d75d427918b068293e5b4ebbc98cd) Result = SUCCESS mguenther : 7066daf3ee9d75d427918b068293e5b4ebbc98cd Files : core/src/main/java/hudson/triggers/SCMTrigger.java
            dogfood dogfood added a comment -

            Integrated in jenkins_ui-changes_branch #26
            JENKINS-10880 output the job when polling fails (Revision 7066daf3ee9d75d427918b068293e5b4ebbc98cd)

            Result = SUCCESS
            mguenther : 7066daf3ee9d75d427918b068293e5b4ebbc98cd
            Files :

            • core/src/main/java/hudson/triggers/SCMTrigger.java
            dogfood dogfood added a comment - Integrated in jenkins_ui-changes_branch #26 JENKINS-10880 output the job when polling fails (Revision 7066daf3ee9d75d427918b068293e5b4ebbc98cd) Result = SUCCESS mguenther : 7066daf3ee9d75d427918b068293e5b4ebbc98cd Files : core/src/main/java/hudson/triggers/SCMTrigger.java
            joekearney Joe Kearney added a comment -

            Does this fix go in the Git plugin or in something more central in Jenkins?

            If the former, can the same fix be applied to the Mercurial version of this bug (JENKINS-13669)? I still see the problem in plugin version 1.41.

            If the latter, will this make it into the release soon? I see the same issue in 1.471.

            joekearney Joe Kearney added a comment - Does this fix go in the Git plugin or in something more central in Jenkins? If the former, can the same fix be applied to the Mercurial version of this bug ( JENKINS-13669 )? I still see the problem in plugin version 1.41. If the latter, will this make it into the release soon? I see the same issue in 1.471.

            Code changed in jenkins
            User: Marc Guenther
            Path:
            src/main/java/hudson/plugins/git/GitSCM.java
            http://jenkins-ci.org/commit/git-plugin/91cc5c968070ffd6bb47568b5aa3d2da4859938b
            Log:
            [FIXED JENKINS-10880] check for existing lastBuild

            Fix the NPE when there was no lastBuild available with
            fast remote polling enabled

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Marc Guenther Path: src/main/java/hudson/plugins/git/GitSCM.java http://jenkins-ci.org/commit/git-plugin/91cc5c968070ffd6bb47568b5aa3d2da4859938b Log: [FIXED JENKINS-10880] check for existing lastBuild Fix the NPE when there was no lastBuild available with fast remote polling enabled

            Code changed in jenkins
            User: Kohsuke Kawaguchi
            Path:
            src/main/java/hudson/plugins/git/GitSCM.java
            http://jenkins-ci.org/commit/git-plugin/0551fc3bf4b35b6afba71126f23ba0c01a9b3142
            Log:
            Merge pull request #65 from marc-guenther/jenkins-10880

            [FIXED JENKINS-10880] check for existing lastBuild

            Compare: https://github.com/jenkinsci/git-plugin/compare/b0cf7b7cd9c8...0551fc3bf4b3

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: src/main/java/hudson/plugins/git/GitSCM.java http://jenkins-ci.org/commit/git-plugin/0551fc3bf4b35b6afba71126f23ba0c01a9b3142 Log: Merge pull request #65 from marc-guenther/jenkins-10880 [FIXED JENKINS-10880] check for existing lastBuild Compare: https://github.com/jenkinsci/git-plugin/compare/b0cf7b7cd9c8...0551fc3bf4b3

            People

              kohsuke Kohsuke Kawaguchi
              robertdw robertdw
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: