cancel
Showing results for 
Search instead for 
Did you mean: 

PropertyEntity[next.dbid] was updated by another transaction

erensimsek
Champ in-the-making
Champ in-the-making
Hi everyone,

We have an application that, it has 8 instance.. of course they includes theirself proccessengine.

When we run

runtimeService.startProcessInstanceByKey("ReceiveTaskTimerTest")


we get this error.


SEVERE: Error while closing command context
org.activiti.engine.ActivitiOptimisticLockingException: PropertyEntity[next.dbid] was updated by another transaction concurrently
        at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:435)
        at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:348)

How can we resolve this problem.?

Thank you?
9 REPLIES 9

erensimsek
Champ in-the-making
Champ in-the-making
Hi again,

When call

runtimeService.startProcessInstanceByKey("ReceiveTaskTimerTest")

activiti execute this query:

select * from ACT_GE_PROPERTY where NAME_ = 'next.dbid'

if query result that: 'next.dbid',1,1

and after execute this query:

update ACT_GE_PROPERTY SET REV_ = 2, VALUE_ = (1+idBlockSize) where NAME_ = 'next.dbid' and REV_ = 1

So, when we executing the last query concurrently, we will get optimisticlockException.

As a result we want to update the first query for oracle like that:
select * from ACT_GE_PROPERTY where NAME_ = 'next.dbid'  for update

is it dangerous for activiti procces engine and their components..?

thank you.

erensimsek
Champ in-the-making
Champ in-the-making
There is no answer?

trademak
Star Contributor
Star Contributor
Hi,

Is it not possible to do a retry when you receive an optimistic lock exception?
I don't think the query change you propose will have any negative effects on the Activiti Engine.
Just a question out of curiosity, do you have so much users for that application that it needs 8 instances of Activiti?

Best regards,

erensimsek
Champ in-the-making
Champ in-the-making
Hi.

Yes its possible to do a retry; but i dont want to transaction rollback.  
Also i increased the proccess engine idBlockSize (act_ge_property) value from 100 to 2000, so the rollback count is increased.

Yes we need 8 instance of activiti, because we want to start 500.000 proccesses in every hour. Smiley Happy

Is there any project like this have high count procces instance?

And if you want to see our proccess design attached it. 

Thank you.

trademak
Star Contributor
Star Contributor
Hi,

There are some high volume examples I know of, but 500.000 per hour is the highest number I've heard of.
I think the query change would be a good option. Did you already do some tests with the query change?

Best regards,

erensimsek
Champ in-the-making
Champ in-the-making
Hi,

Yes, we did test with this query.

We didnt get any exception. Our performans test is succesfully completed.

I think all activiti query must review for multi instance..

Thank your for reply.

Best regards.

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
You can use another db id generator class that does not rely on the db but uses uuids. Search the forum and jira for this (have no link at hand)

And a retry when retrieving a block of id's and getting an OLE would indeed be an enhancement I think. Please fie a jira issue for this.

danniv21
Champ in-the-making
Champ in-the-making
HI,

Any solution please,

I have the similar problem:

2014-04-03 14:51:46,994 ERROR [com.x.workflow.evaluation.xxxxxxxxxxxxxxxxxTask] - An exception occurs on xxxxxxxxxxxxxxxTask: org.activiti.engine.ActivitiOptimisticLockingException: PropertyEntity[name=next.dbid, value=4345101] was updated by another transaction concurrently
at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:562)
at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:444)
at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:170)
at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:117)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
at org.activiti.engine.impl.db.DbIdGenerator.getNewBlock(DbIdGenerator.java:43)
at org.activiti.engine.impl.db.DbIdGenerator.getNextId(DbIdGenerator.java:36)
at org.activiti.engine.impl.db.DbSqlSession.insert(DbSqlSession.java:111)
at org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.createAndInsert(VariableInstanceEntity.java:61)
at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.createVariableInstance(VariableScopeImpl.java:369)
at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.createVariableLocal(VariableScopeImpl.java:289)
at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.createVariableLocal(VariableScopeImpl.java:276)
at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariable(VariableScopeImpl.java:256)
at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariable(VariableScopeImpl.java:252)
at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariable(VariableScopeImpl.java:239)
at com.x.workflow.evaluation.xxxxxxxxxxxxx.execute(xxxxxxxxxxxxxTask.java:105)
at sun.reflect.GeneratedMethodAccessor744.invoke(Unknown Source)


trademak
Star Contributor
Star Contributor
Are you using multiple Activiti Engines?
An alternative is to use the StrongUuidGenerator instead. That would prevent you from getting this error.

Best regards,