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

Poll SCM trigger no functioning during the first execution

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • integrity-plugin
    • None
    • MKS Integrity 2009 SP5 - Windows 2008 R2
      Jenkins v1.512

      The first time "poll SCM" is executed, it fails because of a java.lang.NullPointerException

          [JENKINS-21479] Poll SCM trigger no functioning during the first execution

          I reviewed the source code of the plugin and it seems like the projects map is initialized the first time getIntegrityProject() is called by compareRemoteRevisionWith. As a consequence, siProject is set to null and there is an exception thrown:

          java.lang.NullPointerException
          at hudson.scm.IntegritySCM.compareRemoteRevisionWith(IntegritySCM.java:939)
          at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
          at hudson.scm.SCM.poll(SCM.java:373)
          at hudson.model.AbstractProject._poll(AbstractProject.java:1585)
          at hudson.model.AbstractProject.poll(AbstractProject.java:1494)
          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(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)

          Gregory Pierre added a comment - I reviewed the source code of the plugin and it seems like the projects map is initialized the first time getIntegrityProject() is called by compareRemoteRevisionWith. As a consequence, siProject is set to null and there is an exception thrown: java.lang.NullPointerException at hudson.scm.IntegritySCM.compareRemoteRevisionWith(IntegritySCM.java:939) at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356) at hudson.scm.SCM.poll(SCM.java:373) at hudson.model.AbstractProject._poll(AbstractProject.java:1585) at hudson.model.AbstractProject.poll(AbstractProject.java:1494) 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(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)

          Have you set a 'Configuration Name' for your Job configuration? Its a new parameter, added in 1.18

          Cletus D'Souza added a comment - Have you set a 'Configuration Name' for your Job configuration? Its a new parameter, added in 1.18

          Yes, the configuration name is set. I think the summary of this bug is wrong. The poll SCM fails the first time it is executed with the null pointer exception (see my commment above). After a Jenkins reboot, the first poll SCM execution fails the same way. I noticed that behavior this week after some investigations. It was causing troubles in our system because this trigger is executed once per week.
          FYI, I worked around the problem by adding these three line before calling compareBaseline.

          if(siProject == null)
          {
          siProject = getIntegrityProject();
          }
          int changeCount = siProject.compareBaseline(projectDB, api);

          Gregory Pierre added a comment - Yes, the configuration name is set. I think the summary of this bug is wrong. The poll SCM fails the first time it is executed with the null pointer exception (see my commment above). After a Jenkins reboot, the first poll SCM execution fails the same way. I noticed that behavior this week after some investigations. It was causing troubles in our system because this trigger is executed once per week. FYI, I worked around the problem by adding these three line before calling compareBaseline. if(siProject == null) { siProject = getIntegrityProject(); } int changeCount = siProject.compareBaseline(projectDB, api);

          Thanks! Will review this suggestion for the next release.

          Cletus D'Souza added a comment - Thanks! Will review this suggestion for the next release.

          Code changed in jenkins
          User: Cletus D'Souza
          Path:
          src/main/java/hudson/scm/APISession.java
          src/main/java/hudson/scm/IntegrityCMProject.java
          src/main/java/hudson/scm/IntegrityCheckoutTask.java
          src/main/java/hudson/scm/IntegritySCM.java
          http://jenkins-ci.org/commit/integrity-plugin/9c4605abb92d6adebd8618828bd8c49e3d0cb526
          Log:
          Resolved the following issues:
          JENKINS-21587: memory leak in Plugin 1.22 -orphaned Logger Threads (accepted patch from Matthias Rump - thank you!)
          JENKINS-21479: Poll SCM trigger no functioning during the first execution
          JENKINS-21260: PTC integrity plugin: version 1.19 instantly triggers new build though corresponding files in repository have not been changed!

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Cletus D'Souza Path: src/main/java/hudson/scm/APISession.java src/main/java/hudson/scm/IntegrityCMProject.java src/main/java/hudson/scm/IntegrityCheckoutTask.java src/main/java/hudson/scm/IntegritySCM.java http://jenkins-ci.org/commit/integrity-plugin/9c4605abb92d6adebd8618828bd8c49e3d0cb526 Log: Resolved the following issues: JENKINS-21587 : memory leak in Plugin 1.22 -orphaned Logger Threads (accepted patch from Matthias Rump - thank you!) JENKINS-21479 : Poll SCM trigger no functioning during the first execution JENKINS-21260 : PTC integrity plugin: version 1.19 instantly triggers new build though corresponding files in repository have not been changed!

          Suggestion incorporated! Thanks!

          Cletus D'Souza added a comment - Suggestion incorporated! Thanks!

            cdsouza Cletus D'Souza
            gpierre Gregory Pierre
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: