Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-44857

Some invalid cron expressions are accepted, sometimes with unexpected results

    XMLWordPrintable

Details

    Description

      There are several types of cron expression errors that Quartz fails to recognize as such, and sometimes this can result in the job not being scheduled or running at unexpected times. A few examples discovered in JIRA Cloud include:

      • 0 0/150 * * * ? */150 is out of range. If the expression had been specified using */150, which on the surface would mean the same thing, then Quartz would report the error. Instead, with a starting value of 0 explicitly given, Quartz silently ignores the invalid interval.
      • 0 40 9 1W,15W 1-12 ? 2010-2050 – Multiple values are not supported for the W flag. When you list multiple values, the W flag state on the first value wins. If the first value specifies it, then the other values are silently ignored. If it does not, then the W flag is silently ignored for the other values.

      Clearly the intent of the first cron expression is to run a job every 2 1/2 hours, but it actually isn't possible to express that using a cron expression, and since the invalid interval gets ignored, the job actually runs every hour. The intent of the second one is to run on the weekdays closest to the 1st and 15th of the month, but only the 1st of the month is actually honoured.

      JIRA should either reject these expressions or honour their spirit. It should not silently accept them as if they are valid but then do something else.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cfuller crf
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: