-
Bug Report
-
Resolution: Unresolved
-
L3 - Default
-
None
-
7.17.0
-
None
Environment (Required on creation):
Any Camunda environment.
Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):
While creating a process definition with a repeating interval and a start date (example R2/2022-07-18T09:18:00Z/PT1M), the Camunda engine will instantiate one more process instance compared to the repeating interval number specified (3 instead of 2 in the example).
Steps to reproduce (Required on creation):
Execute the test included in this PR:
https://github.com/camunda/camunda-bpm-platform/pull/1968
or the test submitted by krisdacoder:
@Test public void shouldNotExceedNumberPeriodsWithTimeCycle() throws Exception { ClockUtil.setCurrentTime(parse("19700101-00:00:00")); DurationHelper dh = new DurationHelper("R2/1970-01-01T00:30:00/PT2M"); assertEquals(parse("19700101-00:30:00"), dh.getDateAfter()); // simulate some execution time of 10 seconds ClockUtil.setCurrentTime(parse("19700101-00:30:10")); assertEquals(parse("19700101-00:31:00"), dh.getDateAfter()); // simulate some execution time of 10 seconds ClockUtil.setCurrentTime(parse("19700101-00:31:10")); assertNull("There must not be more than 2 repetitions", dh.getDateAfter()); }
or create a process definition with a repeating interval including a start date e.g., "R2/2022-07-18T09:18:00Z/PT1M".
Observed Behavior (Required on creation):
The number of process instances instantiated is equal to the number of repetitions + 1.
Expected behavior (Required on creation):
The number of process instances instantiated should be equal to the number of repetitions.
Root Cause (Required on prioritization):
This loop which calculates the next date calculates the repeats based on the start date. When the start date is part of the expression though this leads to the timer firing once when the start date is reached and then n times to match the expression of Rn repeats.
Hey krisdacoder. thanks for reaching out to us with this bug report. Great to see that you already wrote a test to reproduce the issue. This always helps with the investigation.
I can confirm, that this is not expected and will be treated as a bug. When specifying a start date in the timer configuration like R2/1970-01-01T00:00:00/PT10S we expect the timer to fire two times. This is also documented with an example: https://docs.camunda.org/manual/latest/reference/bpmn20/events/timer-events/#timer-start-event
If you are interested in fixing this bug, this would be very much appreciated. Just let us know here in the ticket. We can help you with questions if you need any assistance. Otherwise, I will be forwarding the ticket for prioritization. I can not say when we will be able to work on it though.
Best,
Miklas