cancel
Showing results for 
Search instead for 
Did you mean: 

ServiceTask async join problem on MySQL

huksley
Champ in-the-making
Champ in-the-making
I am experiencing problem with simple process:


[start] -> [excl-gateway] -> [user task] -> [excl-gateway] -> [end]
                       ->   [async svctask]        -^


the problem is, when async svc task finishes
it is still in list of executors and msg in log

org.activiti.engine.impl.cmd.JobRetryCmd execute
SEVERE: activitiy or FailedJobRetryTimerCycleValue is null in job 10'. only decrementing retries.

if running with tracing I get
ProcessInstance[5] was updated by another transaction concurrently

I`ve created testcase project.

https://github.com/huksley/activiti-async-errors-mysql

When running with H2, everything works fine.
Using MySQL 5.5.41-0ubuntu0.12.04.1
I am experiencing error, service task not closing
7 REPLIES 7

jbarrez
Star Contributor
Star Contributor
I don't seem to be able to run your project. For example the pom.xml has 5.15 as Activiti version, while the async executor was introduced later. Also got a Spring error. Could you check if the project runs for you?

Secondly, from your logging it seems like two process engines are booting up? That would explain the concurrent transaction exception …

huksley
Champ in-the-making
Champ in-the-making
Fixed maven config - upgraded Activiti version, added MySQL connector as artefact.
After running mvn compile; mvn test - error persists on Mac OS - Java 1.6.0_65, MySQL 5.5.28

You might need to change src/test/resources/activiti.cfg.xml to suit your environment.

About two instances… I follow unittest template. Running single test instance. No other process access database.

Thanks in advance!

huksley
Champ in-the-making
Champ in-the-making
Tried on MySQL 5.6.25 on Windows - same error.
Tried on H2 Server mode, using url jdbc:h2:tcp://localhost/~/activiti - NO ERROR

huksley
Champ in-the-making
Champ in-the-making
Fixed project. Maybe my process definition is incorrect?

jbarrez
Star Contributor
Star Contributor
Ok, perfect, now I could run it straight away without any problem, thanks.

What happens is that, after the process instance is started, both the 'task complete' and the 'async service task happen at the same time, in two different threads. One of the two will 'win', as they both need to join in the joining parallel gateway. In this case, the async job often loses (you see an optimistic locking exception in the log), and the task complete wins. At that point, the due date is recalculated (+ 5 minutes) to retry later.

A workaround for this pattern is to make the joining parallel gateway async and exclusive:

<code>
<parallelGateway id="parallelgateway2"  activiti:async="true" activiti:exclusive="true"></parallelGateway>
</code>



huksley
Champ in-the-making
Champ in-the-making
Thanks for information and help. Is there any best practices on this? What I try to accomplish is to make in parallel user reviewing loan request and automatic security checking. Maybe I better use messaging/signaling?

jbarrez
Star Contributor
Star Contributor
Making the joining gateway async and exclusive is a good idea anyway for this pattern, that avoids having concurrent joins (which is the issue here).

What do you mean with messaging/signalling? It can mean a lot of things 🙂
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.