Skip to content

Fix CRON timer wrongly computes after date when L expression is used #4944

@joaquinfelici

Description

@joaquinfelici

Environment (Required on creation)

Any.

Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket)

A client is experiencing an issue where his start timer event with a Cron expression is creating infinite jobs instead of the ones that match the expression. The reason behind it seems to be an bug in the CronExpression getTimeAfter algorithm, only for expressions containing "L-X" meaning X days before the end of the month. For example 0 0 12 L-27 * ? which means 27 days before the end of each month at 12:00:00.

The CronExpression class is interpreting the expression correctly, but when getting the "after time", meaning the next date that matches the expression, it's not working and returning the date for the current month even if it's in the past.

Steps to reproduce (Required on creation)

  1. Deploy a process definition with a start event timer with a Cron expression containing the L-X syntax, for example 0 0 12 L-27 * ?.
  2. The X should be greater than the remaining days in the current month to reproduce the behavior.

Observed Behavior (Required on creation)

The computed execution date will be in the past, and this will trigger the execution multiple times instead of once.

Expected behavior (Required on creation)

The computed execution should always be in the future. If the target date has already passed for the current month, then it should be created once for the following month.

Root Cause (Required on prioritization)

There's a bug in the CronExpression getTimeAfter algorithm.

Solution Ideas

  • Either fix the bug by taking inspiration of the latest release of Quartz Library. If we follow this approach, take this bug into account (and it's correction).
  • Or directly use their library as a dependency.

Hints

Created a pull request that contains:

  • The expected behavior in the test additions.
  • A POC for the CronExpression class.

Links

Breakdown

Pull Requests

Dev2QA handover

  • Does this ticket need a QA test and the testing goals are not clear from the description? Add a Dev2QA handover comment

Metadata

Metadata

Assignees

Labels

group:supportAll requests that are linked to a customer request. DRI: Tassilotype:bugIssues that describe a user-facing bug in the project.version:7.24.0version:7.24.0-alpha2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions