cancel
Showing results for 
Search instead for 
Did you mean: 

Multi Instance (Not Sequential) Call Activity Exception

archana071
Champ in-the-making
Champ in-the-making
Hi

I have main process which has call activity inside it ( calls another process/ bpmn file) and is multi instance loop not sequential. When the instances of the call activity complete their execution it has to return to the main process as expected. But it throws exceptions in the Database as follows

'HistoricVariableInstanceEntity[id=xxxx, name=nrOfCompletedInstances, revision=0, type=integer, longValue=1, textValue=1] was updated by another transaction concurrently'

'HistoricVariableInstanceEntity[id=xxxx, name=nrOfActiveInstances, revision=0, type=integer, longValue=1, textValue=1] was updated by another transaction concurrently'

And these variables are activiti variables which I am not updating in any of my service tasks.

Can you please tell me what could be the reason for such exceptions and any solutions to resolve it.

Thank you
4 REPLIES 4

cjose
Elite Collaborator
Elite Collaborator
Hello Archana,

If the subprocesses are being completed at the same time, you could get this error. What do you have inside the subprocess for these subprocesses to get completed at the same time?

Ciju

archana071
Champ in-the-making
Champ in-the-making
Hi

Thank you for your reply. Yes my subprocess (call activity) has logic that both instances of it executing in parallel almost end at the same time ( as same logic for both of them and I trigger them at same time ) . But activiti might be able to handle such concurrency issues right when multi instance non sequential feature is allowed (as it is the issue with activiti updating its process variables )?

I would like to know if Is this existing behavior of multi instance loops or any problem with our code/logic inside delegates??

Thanks again.

cjose
Elite Collaborator
Elite Collaborator
Are these long running subprocesses being executed in parallel? If they are short lived subprocesses, is there any reason why they should be parallel? As far as I understand the optimistic locking exception is an expected behaviour during concurrent updates! Do you mind sharing your use-case, depending on your use case there may be different ways to help avoid these sort of errors?

Ciju

archana071
Champ in-the-making
Champ in-the-making
My subprocess (call activity has timer tasks which polls for external source response after waiting x minutes). And the logic inside my subprocess is independent for each instance. So if trigger say 10 or 20 instances of my subprocess I want them to run in parallel to reduce the overall execution time. (Otherwise it takes very long time for all the 20 instances if they are executed as sequential).

My issue is similar to the following thread.
https://forums.activiti.org/content/using-asyncexecutor-activitioptimisticlockingexception-activiti-...

Thank you