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

NullPointerException loading Pipeline Job with dynamic gerrit triggers

    Details

    • Similar Issues:

      Description

      • create a pipeline Job with dynamic gerrit triggers
      • open "Configure" again and save again (important)
      • restart Jenkins
      • you'll get a NPE loading the job:

      WARNING: Frank-pipeline-test-trigger
      java.lang.NullPointerException
      at com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger.cancelTimer(GerritTrigger.java:553)
      at com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger.stop(GerritTrigger.java:629)
      at org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty.stopTriggers(PipelineTriggersJobProperty.java:93)
      at org.jenkinsci.plugins.workflow.job.WorkflowJob.onLoad(WorkflowJob.java:149)
      at hudson.model.Items.load(Items.java:333)
      at jenkins.model.Jenkins$17.run(Jenkins.java:2823)
      at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
      at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
      at jenkins.model.Jenkins$7.runTask(Jenkins.java:998)
      at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
      at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)

      the problem is the <gerritTriggerTimerTask> node in the job's config.xml:

      • When you freshly create the pipeline job (including dynamic trigger settings), the xml-node is not there and the job is loading correctly, even when restarting jenkins
      • as soon as you re-save the job config, the <gerritTriggerTimerTask> node is inserted in the job's xml and now on the next Jenkins restart the job fails to load with an NPE as stated above
      • if you don't restart the jenkins, the job keeps working and is still editable, also dynamic triggers work, but as soon as you restart jenkins, the job is no longer accessible
      • if you manually remove the <gerritTriggerTimerTask> node in the job's config.xml in the jenkins backend and restart jenkins, the job becomes available again (until the next save + restart)

        Attachments

          Activity

          Hide
          renwei Wei Ren added a comment -

          I am hitting the exactly same issue. My environment is "Jenkins 2.19.4 + pipeline 2.4 + Gerrit trigger 2.23.0".

          Show
          renwei Wei Ren added a comment - I am hitting the exactly same issue. My environment is "Jenkins 2.19.4 + pipeline 2.4 + Gerrit trigger 2.23.0".
          Hide
          neonman Max P added a comment -

          Same error with all latests plugin. Workaround: wrap line 553 in GerritTrigger.java with try-catch:

          try {
              logger.trace("GerritTrigger.cancelTimer(): {0}", job.getName());
          } catch (NullPointerException e) {
              logger.trace("Not found job name");
          }
          

          and it now works as expected

          Show
          neonman Max P added a comment - Same error with all latests plugin. Workaround: wrap line 553 in GerritTrigger.java with try-catch: try { logger.trace( "GerritTrigger.cancelTimer(): {0}" , job.getName()); } catch (NullPointerException e) { logger.trace( "Not found job name" ); } and it now works as expected
          Hide
          erbarr Eric Barrera added a comment -

          Thanks Max for the workaround. It's been working good. I checked 2.23.1 yesterday and this issue is still present.

          Show
          erbarr Eric Barrera added a comment - Thanks Max for the workaround. It's been working good. I checked 2.23.1 yesterday and this issue is still present.
          Hide
          alonbl Alon Bar-Lev added a comment -
          Show
          alonbl Alon Bar-Lev added a comment - A push request is available [1]   [1] https://github.com/jenkinsci/gerrit-trigger-plugin/pull/314
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Alon Bar-Lev
          Path:
          src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTrigger.java
          http://jenkins-ci.org/commit/gerrit-trigger-plugin/1d32470048bd54d3fa14f3940bf709ad4dced2b3
          Log:
          JENKINS-38542 NPE when canceling a task when no job

          Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alon Bar-Lev Path: src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTrigger.java http://jenkins-ci.org/commit/gerrit-trigger-plugin/1d32470048bd54d3fa14f3940bf709ad4dced2b3 Log: JENKINS-38542 NPE when canceling a task when no job Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Robert Sandell
          Path:
          src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTrigger.java
          http://jenkins-ci.org/commit/gerrit-trigger-plugin/e0ad9f1cf9190b0db67fcb43fa1aea33c946c631
          Log:
          Merge pull request #314 from alonbl/JENKINS-38542

          JENKINS-38542 NPE when canceling a task when no job

          Compare: https://github.com/jenkinsci/gerrit-trigger-plugin/compare/35a03f05e254...e0ad9f1cf919

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Robert Sandell Path: src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTrigger.java http://jenkins-ci.org/commit/gerrit-trigger-plugin/e0ad9f1cf9190b0db67fcb43fa1aea33c946c631 Log: Merge pull request #314 from alonbl/ JENKINS-38542 JENKINS-38542 NPE when canceling a task when no job Compare: https://github.com/jenkinsci/gerrit-trigger-plugin/compare/35a03f05e254...e0ad9f1cf919

            People

            • Assignee:
              rsandell rsandell
              Reporter:
              frank_bartz fbartz
            • Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: