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

NPE at hudson.triggers.SCMTrigger$Runner.hashCode when run is called with job == null

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • Jenkins v1.622
      Mercurial plugin v1.54

      I have several projects on my Jenkins server.
      My projects stored in Mercurial SCM.
      For trigger build I use notifyCommit as mentioned in plugin WiKi:

      http://localhost:8080/mercurial/notifyCommit?url=<repository remote url>
      

      Most of my projects builds after trigger, but one project when get notification send me error report (see attached file jenkins-response.html).

          [JENKINS-29945] NPE at hudson.triggers.SCMTrigger$Runner.hashCode when run is called with job == null

          Jesse Glick added a comment -
          java.lang.NullPointerException
          	at hudson.triggers.SCMTrigger$Runner.hashCode(SCMTrigger.java:572)
          	at java.util.HashMap.hash(HashMap.java:362)
          	at java.util.HashMap.put(HashMap.java:492)
          	at hudson.util.SequentialExecutionQueue.execute(SequentialExecutionQueue.java:65)
          	at hudson.triggers.SCMTrigger.run(SCMTrigger.java:143)
          	at hudson.triggers.SCMTrigger.run(SCMTrigger.java:120)
          	at hudson.plugins.mercurial.MercurialStatus.handleNotifyCommit(MercurialStatus.java:117)
          	at hudson.plugins.mercurial.MercurialStatus.doNotifyCommit(MercurialStatus.java:75)
          

          Code

          Jesse Glick added a comment - java.lang.NullPointerException at hudson.triggers.SCMTrigger$Runner.hashCode(SCMTrigger.java:572) at java.util.HashMap.hash(HashMap.java:362) at java.util.HashMap.put(HashMap.java:492) at hudson.util.SequentialExecutionQueue.execute(SequentialExecutionQueue.java:65) at hudson.triggers.SCMTrigger.run(SCMTrigger.java:143) at hudson.triggers.SCMTrigger.run(SCMTrigger.java:120) at hudson.plugins.mercurial.MercurialStatus.handleNotifyCommit(MercurialStatus.java:117) at hudson.plugins.mercurial.MercurialStatus.doNotifyCommit(MercurialStatus.java:75) Code

          First of all bad objects must not to be send to queue, object/Runner has no sense when job is null, so nothing can be changed in hashCode, because scm plugins usually send it through SequentialExecutionQueue to exclude duplicated runs for the same job.

          Added annotations, stubs and tests in https://github.com/jenkinsci/jenkins/pull/1783

          Kanstantsin Shautsou added a comment - First of all bad objects must not to be send to queue, object/Runner has no sense when job is null, so nothing can be changed in hashCode, because scm plugins usually send it through SequentialExecutionQueue to exclude duplicated runs for the same job. Added annotations, stubs and tests in https://github.com/jenkinsci/jenkins/pull/1783

          Code changed in jenkins
          User: Kanstantsin Shautsou
          Path:
          core/src/main/java/hudson/triggers/SCMTrigger.java
          core/src/main/java/hudson/triggers/TimerTrigger.java
          core/src/main/java/hudson/triggers/Trigger.java
          core/src/test/java/hudson/triggers/SCMTriggerTest.java
          core/src/test/java/hudson/triggers/TimerTriggerTest.java
          http://jenkins-ci.org/commit/jenkins/79c0bbf76680c8491e601be76d062299b7170971
          Log:
          Protect from race condition in Triggers

          [FIXED JENKINS-29790] [FIXED JENKINS-29945]

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kanstantsin Shautsou Path: core/src/main/java/hudson/triggers/SCMTrigger.java core/src/main/java/hudson/triggers/TimerTrigger.java core/src/main/java/hudson/triggers/Trigger.java core/src/test/java/hudson/triggers/SCMTriggerTest.java core/src/test/java/hudson/triggers/TimerTriggerTest.java http://jenkins-ci.org/commit/jenkins/79c0bbf76680c8491e601be76d062299b7170971 Log: Protect from race condition in Triggers [FIXED JENKINS-29790] [FIXED JENKINS-29945]

            integer Kanstantsin Shautsou
            aleksei_badyaev Aleksei Badyaev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: