Skip to content

[JENKINS-36748] Jobs with syntactically incorrect config missing the cron spec for a trigger produces NullPointerException #17349

Closed

Description

@jenkins-infra-bot

To re-produce you just need to use the https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin and not use the "cron('H/5 * * * *')" as the documentation says.

Then, the following stacktrace is triggered:

Jun 23, 2016 10:35:00 AM hudson.triggers.Trigger$Cron doRun
WARNING: Cron thread throw an exception
java.lang.NullPointerException
    at hudson.triggers.Trigger.checkTriggers(Trigger.java:267)
    at hudson.triggers.Trigger$Cron.doRun(Trigger.java:221)
    at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:50)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    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)

Any cron job on the instance will work because of this issue


Originally reported by fbelzunc, imported from: Jobs with syntactically incorrect config missing the cron spec for a trigger produces NullPointerException
  • assignee: fbelzunc
  • status: Resolved
  • priority: Minor
  • component(s): core
  • label(s): 2.19.1-fixed
  • resolution: Fixed
  • resolved: 2016-07-25T09:43:51+00:00
  • votes: 0
  • watchers: 3
  • imported: 2025-11-24
Raw content of original issue

To re-produce you just need to use the https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin and not use the "cron('H/5 * * * *')" as the documentation says.

Then, the following stacktrace is triggered:

Jun 23, 2016 10:35:00 AM hudson.triggers.Trigger$Cron doRun
WARNING: Cron thread throw an exception
java.lang.NullPointerException
    at hudson.triggers.Trigger.checkTriggers(Trigger.java:267)
    at hudson.triggers.Trigger$Cron.doRun(Trigger.java:221)
    at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:50)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    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)

Any cron job on the instance will work because of this issue

Activity

  1. jenkins-infra-bot commented on Jul 25, 2016

    @jenkins-infra-bot
    Author
    danielbeck:
    • Original comment link
    • Raw content of original comment:

      Fixed in 2.15

    Fixed in 2.15

  2. jenkins-infra-bot commented on Jul 27, 2016

    @jenkins-infra-bot
    Author
    jglick:
    • Original comment link
    • Raw content of original comment:

      I would say this may not have been a defect to begin with. The plugin documentation describes the proper usage of this trigger with Job DSL. The Jenkins GUI will ensure that cron is non-null, but from a scripted client like Job DSL you are expected to define all mandatory fields. If cron is meaningfully optional in this context—some Trigger implementations do not really require it, because they have an empty run, though I think this one does—then Trigger.readResolve should set it to the empty string rather than null.

    I would say this may not have been a defect to begin with. The plugin documentation describes the proper usage of this trigger with Job DSL. The Jenkins GUI will ensure that cron is non-null, but from a scripted client like Job DSL you are expected to define all mandatory fields. If cron is meaningfully optional in this context—some Trigger implementations do not really require it, because they have an empty run, though I think this one does—then Trigger.readResolve should set it to the empty string rather than null.

  3. jenkins-infra-bot commented on Jul 27, 2016

    @jenkins-infra-bot
    Author
    danielbeck:
    • Original comment link
    • Raw content of original comment:

      jglick It's ugly – further investigation showed that the problem is that GhprbTrigger#readResolve doesn't call super.readResolve() – which would prevent the invalid trigger from being created.

      Still a valid robustness improvement IMO.

    jglick It's ugly – further investigation showed that the problem is that GhprbTrigger#readResolve doesn't call super.readResolve() – which would prevent the invalid trigger from being created.

    Still a valid robustness improvement IMO.

  4. jenkins-infra-bot commented on Aug 24, 2016

    @jenkins-infra-bot
    Author
    scm_issue_link:

    Code changed in jenkins
    User: Felix Belzunce Arcos
    Path:
    core/src/main/java/hudson/triggers/Trigger.java
    test/src/test/java/hudson/triggers/TriggerTest.java
    http://jenkins-ci.org/commit/jenkins/4278804582b34f123414bde521bd91b009d8e353
    Log:
    JENKINS-36748 Do not process null specs in triggers (#2482)

  5. jenkins-infra-bot commented on Aug 27, 2016

    @jenkins-infra-bot
    Author
    oleg_nenashev:
    • Original comment link
    • Raw content of original comment:

      Additional fix has been merged towards jenkins-2.20

    Additional fix has been merged towards jenkins-2.20

  6. jenkins-infra-bot commented on Sep 9, 2016

    @jenkins-infra-bot
    Author
    scm_issue_link:

    Code changed in jenkins
    User: Felix Belzunce Arcos
    Path:
    core/src/main/java/hudson/triggers/Trigger.java
    test/src/test/java/hudson/triggers/TriggerTest.java
    http://jenkins-ci.org/commit/jenkins/a59dd9d45f544b6464bf0574ab5a0bb12b7d7008
    Log:
    JENKINS-36748 Do not process null specs in triggers (#2482)

    (cherry picked from commit 4278804)

  7. removed
    bugFor changelog: Minor bug. Will be listed after features
    on Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions