cancel
Showing results for 
Search instead for 
Did you mean: 

Time cycle bad behaviour

ejyanezp
Champ in-the-making
Champ in-the-making
Hi Activiti developers,

I think I bump into an engine's bug.

I have the following process (i'll put only the semantic part):

  <process id="enviarRecordatorios" name="Enviar Recordatorios" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <userTask id="usertask1" name="Perform Service"></userTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
    <boundaryEvent id="boundarytimer1" name="Timer" attachedToRef="usertask1" cancelActivity="false">
      <timerEventDefinition>
        <timeCycle>R10/PT5S</timeCycle>
      </timerEventDefinition>
    </boundaryEvent>
    <sequenceFlow id="flow2" sourceRef="usertask1" targetRef="scripttask1"></sequenceFlow>
    <scriptTask id="scripttask1" name="Send Invoice" scriptFormat="groovy" activiti:autoStoreVariables="false">
      <script>def theTime = new Date()
println "Invoice sent at: $thetime"</script>
    </scriptTask>
    <sequenceFlow id="flow3" sourceRef="boundarytimer1" targetRef="scripttask2"></sequenceFlow>
    <scriptTask id="scripttask2" name="Notify Manager" scriptFormat="groovy" activiti:autoStoreVariables="false">
      <script>def theTime = new Date()
println "Manager Notified at: $theTime"</script>
    </scriptTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow4" sourceRef="scripttask1" targetRef="endevent1"></sequenceFlow>
    <sequenceFlow id="flow5" sourceRef="scripttask2" targetRef="endevent1"></sequenceFlow>
  </process>

The output is the following:

id 5 enviarRecordatorios:1:4
Manager Notified at: Tue Oct 21 22:01:36 VET 2014
Manager Notified at: Tue Oct 21 22:01:45 VET 2014
Manager Notified at: Tue Oct 21 22:01:50 VET 2014
Manager Notified at: Tue Oct 21 22:01:56 VET 2014
Manager Notified at: Tue Oct 21 22:01:56 VET 2014
Manager Notified at: Tue Oct 21 22:01:56 VET 2014
Manager Notified at: Tue Oct 21 22:01:56 VET 2014
Manager Notified at: Tue Oct 21 22:01:56 VET 2014
Manager Notified at: Tue Oct 21 22:01:56 VET 2014
Manager Notified at: Tue Oct 21 22:01:56 VET 2014

As you can see not all the time cycles are of 5 seconds. Is it a problem with the Job Executor?.
Thanks or the attention.

Regards,
Eduardo Yánez.
5 REPLIES 5

ejyanezp
Champ in-the-making
Champ in-the-making
BTW I am using the 5.16.3-SNAPSHOT version.
e.

jbarrez
Star Contributor
Star Contributor
The job executor sleeps by default 5 seconds. So if you need 5 second precision, you'll need to make it sleep less than 5 second or you could get an overlap of a few seconds.

ejyanezp
Champ in-the-making
Champ in-the-making
Hi jbarrez, thanks for your attention.

Ok, I understand, so I tested it with 10 second precision and I got:

Date: Wed, 22 Oct 2014 21:36:15 -0430 (VET)
Date: Wed, 22 Oct 2014 21:36:25 -0430 (VET)
Date: Wed, 22 Oct 2014 21:36:35 -0430 (VET)
Date: Wed, 22 Oct 2014 21:36:45 -0430 (VET)
Date: Wed, 22 Oct 2014 21:36:46 -0430 (VET)
Date: Wed, 22 Oct 2014 21:36:46 -0430 (VET)
Date: Wed, 22 Oct 2014 21:36:46 -0430 (VET)
Date: Wed, 22 Oct 2014 21:36:46 -0430 (VET)

After the 4th cycle it does not work well…

Regards,
Eduardo Yánez.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Eduardo.

I have found similar bug
http://jira.codehaus.org/browse/ACT-2127
( I did not investigate it more - may be you can add your jUnit test to the issue)

Regards
Martin

ejyanezp
Champ in-the-making
Champ in-the-making
Hi Martin, thanks for your attention,

I would not put this information on the same bug, because is another behavior. My repeating timer does not start twice, it starts good (only once), and after a few cycles (4 times) it forgets the length of the period and fires several times in one second.

I can register a new bug and perhaps you can give me a hint about where to start viewing the code.

Regards,
Eduardo Yánez.