ActivitiOptimisticLockingException when suspend ProcessInstance
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2013 09:11 AM
What I have:
I have workflow:
start = > [Main process] => [async Subprocess] => [Main Process] => end
What a problem:
When I suspend Main Process by runtimeservice.suspendProcessInstanceById, program throws exception:
P.S.
At the moment when happens runtimeservice.suspendProcessInstanceById is proceeding servicetask of the subprocess.
I have workflow:
start = > [Main process] => [async Subprocess] => [Main Process] => end
What a problem:
When I suspend Main Process by runtimeservice.suspendProcessInstanceById, program throws exception:
Exception in thread "pool-1-thread-2" org.activiti.engine.ActivitiOptimisticLockingException: ConcurrentExecution[25] was updated by another transaction concurrently at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:560) at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:442) at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:169) at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:116) at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:70) at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40) at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:37) at org.activiti.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724)
P.S.
At the moment when happens runtimeservice.suspendProcessInstanceById is proceeding servicetask of the subprocess.
Labels:
- Labels:
-
Archive
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2013 09:28 AM
One additional notion about how it happens:
runtimeservice.suspendProcessInstanceById flush all changes into db, including ConcurrentExecution object. But then each async subprocess try to flush the same values.
runtimeservice.suspendProcessInstanceById flush all changes into db, including ConcurrentExecution object. But then each async subprocess try to flush the same values.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2013 06:04 AM
Could you create a unit test and create a JIRA (with the unit test as attachment)?
Best regards,
Best regards,
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2013 09:20 AM
Do you check the demo below?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2013 09:50 AM
I've wrote a simple demo (only a few dozens of lines) that illustrates my problem
git clone https://github.com/JOLO-/ActivitiOptimisticLockingException-during-suspension.git
P.S.
1. Seems I've no rights to create an issue.
2. Not sure that I've understood you properly when you ask me to write a unit test. Is my demo an unit test?
git clone https://github.com/JOLO-/ActivitiOptimisticLockingException-during-suspension.git
P.S.
1. Seems I've no rights to create an issue.
2. Not sure that I've understood you properly when you ask me to write a unit test. Is my demo an unit test?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2013 06:00 AM
This is just how optimistic locking works… If another thread is running the service-task, and you suspend the process, either the suspend-action OR the commit of the "completed service-task" will get an exception and roll back. That's just the way it works
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2013 02:38 AM
Thank you a lot!
