cancel
Showing results for 
Search instead for 
Did you mean: 

Help required - duplicate executions

robshep
Champ in-the-making
Champ in-the-making
Dear Activiti-users.

The following are the records found  in table act_hi_actinst for proc_inst_id_ = 1697

https://gist.github.com/robshep/7931498/raw/015e67009d33ec8100534a227e2154bd5dc5e146/gistfile1.txt

I noticed that this business object seemed to have multiple processes running. 
I can only see one "process" but there seems to have multiple "executions" running.

Please could somebody help explain 1) what the difference is between a process instance and an execution.

Also please, 2) what sort of actions might have taken place to end up with duplicate executions of the same activities.

(It is a java web app)

Many thanks for any help

Rob
9 REPLIES 9

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Rob.

1) what the difference is between a process instance and an execution.

Following thread could help you:
http://forums.activiti.org/content/execution-vs-processinstance

2) what sort of actions might have taken place to end up with duplicate executions of the same activities.

Are you pointing to

5924 | issueOptionToLandOwner
5931 | issueOptionToLandOwner
There are two user task with different execution Ids but same activityId. I guess they were executed in paralel (may be in parallel loop)

Regards
Martin

frederikherema1
Star Contributor
Star Contributor
1) Difference between a process-instance and an execution is simple: A PI is the root-execution when you're running a process. When you have, for example a parallel gateway in your process, additional executions are created, each representing a parallel path. These executions ARE NOT PI's, but rather reference the PI as being their parent, indicating that they are a child of it. In that execution, more children can be created (e.g. when another parallel gateway is present in a parallel path). Other occasions where another execution would be created is when you're using a sub-process, boundary-events, …

2) The table you're referring to indeed show different activities that were executed for the same "activity" (eg. reviewSiteSurvey). Can you share a diagram of the process you're using? Without it, it's difficult to see what can cause the duplicates. Anyway, duplicate executions can occur and are not necessarily problematic. Maybe also the way you complete the tasks, whould be good to know (java-code).

robshep
Champ in-the-making
Champ in-the-making
Thank you to Martin and Frederick for taking the time to offer your advice and opinions - I'm very grateful.

Thank you for the clarification on PI vs Ex - very helpful.

As to my problem of duplicate executions - There is no parallel gateway before this task: this task is user-task no. 7 of a33 user tasks.  The only parallel gateway is at the end 17+, everything else is user-tasks joined sequentially.

Here is my process (redacted for privacy) - The GREEN process is the earlier noted activity we found to have duplicates (there are some others too)

[IMG]http://i42.tinypic.com/qoiu6w.jpg[/IMG]

The other points to remark upon are as follows.
There are occasionally some "early abort" end stages. where the user can decide to end the process after some particular user tasks.
This functionality is created using a process variable set by a required form variable named "proceedAfter"+activityId
Two conditional sequence flows are connected to the user task - one looks at variable=="YES" (this links to next user task) and the other matches on variable=="NO" (which links to a local end-task) (The form parameters are enumerated YES/NO and can't be null or anything else)

The other thing worth mentioning is that each task also has a boundary timer event, which fire off 3 times after overdue time, which fires a script activity, which in turn fires a mail activity to send the reminders.

These are not shown in the diagram because they are set in code at runtime. (to make a cleaner/simpler diagram)

Lastly,

All user tasks use the same completion form that renders any form variables for submission and calls back to the following line of code:

formService.submitTaskFormData(taskId, map)

I hope that I have explained this process sufficiently.  I think I will manually delete one of the duplicate executions from each of the multiples that I find.

Thank you for any further assistance or suggestions that you have, as to why some processes have duplicate executions.

Regards

Rob






martin_grofcik
Confirmed Champ
Confirmed Champ
I do not see reason why it has 2 executions.
Next steps proposals:
  • Could you create jUnit test for it?
  • Did you try to debug it? (e.g. BreakPoint in org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior.execute(ActivityExecution))
Regards
Martin

frederikherema1
Star Contributor
Star Contributor
Although valid, it's not recommended to use multiple outgoing sequence-flows on an activity. Rather, better to add an exclusive gateway after the task with 2 outgoing flows. But that should not explain the behaviour, but just to make sure, can you try using gateways and see if that has duplicate executions of the activities as well?

The additional executions can be explained by the usage of the timer boundary-events. A bondary-event will create a seperate execution scope around the activity it's attached to. I'll double-check the behaviour of the execution-listeners responsible for adding the ACT_HI_ACTINST instances, might be that it's added BEFORE the scope is created under the parent-execution, and added again when the completing child-execution. I'll come back on this today..

frederikherema1
Star Contributor
Star Contributor
Also remarkable is that the start and end-times of the activities are seconds apart. If something goes wrong with the scope-creation, I expect the difference to be zero or maybe a couple of millis…

frederikherema1
Star Contributor
Star Contributor
I have verified the behaviour of boundary-events and their impact on HistoricActivityInstances. I thought they created duplicates (hence the deleted post Smiley Wink), but I was testing it wrong. Boundary-events don't cause duplicate executions. I suggest trying the exclusive gateway approach.

robshep
Champ in-the-making
Champ in-the-making
Many thanks to both of you for your input.  I do not know why there are duplicate executions. They seem to be initiated around 10 seconds aparts.  Too far apart as you say for automatically retrying software, and too far a apart for "double click" syndrome.

I've realised that my version was quite out of date. I have now upgraded to 5.12.1 (the latest afforded me by the grails plugin)

I'll see if this occurs again with the updated libraries

Thanks for your hlep

yossra
Champ in-the-making
Champ in-the-making

Hi,

For your information, the problem of doubled execution occurs again (using version 5.22.0).

I am also using the exclusive gateway approach