We have a bpmn definition, using which we generate about 70K workflows each quarter. All this time, we were creating workflows only in one database. There is an organizational pitch to create workflows in multiple databases. After we introuduced multiple database configuration, we noticed optimisticlock exception while generating 70K workflows.
We do not see any loss of workflow data, however, we see the exception which bothers us.
To throw some light, we have in our xml - three different jndi to three different databases.
Each of the jndi source have their own transaction manager.
<bean id="processEngineConfiguration" class="class extends org.activiti.spring.SpringProcessEngineConfiguration">
<property name="dataSource" ref="dataSource" />
<property name="dataSourceJndiName" value="#{jndiUrls.jndiWFEngine}" />
<property name="transactionManager" ref="transactionManager" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jobExecutorActivate" value="true" />
<property name="enableDatabaseEventLogging" value="true" />
<property name="activityBehaviorFactory" ref="activityBehaviorFactory"/>
</bean>
We have the above configuration for each datasource. After introducing this configuration, we see optimisticlock exception. Stack trace is:
RuntimeService.postTaskForm(): exception: org.activiti.engine.ActivitiOptimisticLockingException: HistoricVariableInstanceEntity[id=0b532b38-1319-11e8-9dc9-005056bddfe9, name=PreparerSecGroup, revision=0, type=string, textValue=something] was updated by another transaction concurrently.
Can you please provide some pointers on how to resolve this error?
we do not have this issue when we are working with a single database.
Yes I would expect there not to be any data loss. An issue like this was discussed recently and in that case also there was no data loss JobEntity [id=*****] was updated by another transaction concurrently The error suggests that two engines are trying to do the same thing at the same time and only one of them therefore succeeds (i.e. a race condition). As covered in the referenced thread, this is more likely to happen with async tasks and more likely with v5 than v6. Are you seeing the error on an async task/s? If you could share your process definition and which part you see the error on that would help. From the error it looks like you have a form on a task - is the error always related to that form? Are you using v5?
I suspect the parallelGateway is the reason the jobExecutor is in use even though you don't have anything explicitly marked async. You could try turning off jobExecutorActivate and asyncExecutor (using settings in clustering with async tasks and the async executor ) see if it all still works. Other paths available to try are switching to the async job executor and/or upgrading to v6. Other threads on this are using asyncExecutor but ActivitiOptimisticLockingException on activiti 5.21.0 and Enable jobExecutorActivate - Impact .
It might not be an infrastructure, it's just a process problem.
In your process definition, you are connecting from the parallel gateway to the exclusive gateway.
After the exclusive gateway, then two more executions will move.
<parallelGateway id="sid-CC0E1059-1A74-4ABC-AE40-1149501DE4DF"></parallelGateway>
<exclusiveGateway id="sid-BB5FBBF6-21D9-40FE-B038-91A6295B7D39"></exclusiveGateway>
Hi daisuke,
This is how the requirements are laid out. At the start, they want to have both the tasks in parallel. User can take action only on one task. After the user takes action, eg: let us say preparer approval, the preparer na task should no longer be available and the next set of tasks need to be created.
I am not sure if i can remove the gateways above and still satisfy the requirement.
Hi Ryan,
If we turn off jobExecutorActivate, then when the user takes action, would the workflow state move forward?
No. You don't need to remove gateway. You need to replace Exclusive Gateway to Parallel Gateway.
In your process definition, you are connecting from the parallel gateway to the exclusive gateway.
After the exclusive gateway, two executions will be generated and do not match the requirements.
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.