Hello,
I have done some tests on Parallel and Inclusive Gateways with combinations of Async and Exclusive flags, and I have some strange behaviours.
Tests done on processes with 3 parallel branches (1 branch with a catching message event).
I have used 2 test sets: 1 using Parallel gateways, 1 using Inclusive gateways.
And the Inclusive gateway use always the 3 branches (should so be equivalent to the parallel gateway).
Test set 1: Parallel gateways
Test set 2: Inclusive gateways
For each set, different settings on the Join gateway (4):
- Sync (no Async & Exclusive flags)
- Sync & Exclusive
- Async
- Async & Exclusive
And here are the unit test results:
T E S T S
@@@@@@@@@@ TEST_JUNIT_PARALLEL_SYNC
Thu May 09 11:28:38 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:28:38 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:28:41 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:28:41 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:28:41 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:28:48 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:28:48 CEST 2019 LAST STEP 511:28:48,171 [flowable-async-job-executor-thread-1] ERROR org.flowable.job.service.impl.asyncexecutor.DefaultAsyncRunnableExecutionExceptionHandler - Job 44 failed
org.flowable.common.engine.api.FlowableOptimisticLockingException: ProcessInstance[36] was updated by another transaction concurrently
…
at java.lang.Thread.run(Thread.java:748)
Thu May 09 11:28:58 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:29:08 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:29:08 CEST 2019 LAST STEP 5@@@@@@@@@@ TEST_JUNIT_PARALLEL_SYNC_EXCLUSIVE
Thu May 09 11:29:19 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:29:19 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:29:22 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:29:22 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:29:22 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:29:29 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:29:29 CEST 2019 LAST STEP 511:29:29,458 [flowable-async-job-executor-thread-1] ERROR org.flowable.job.service.impl.asyncexecutor.DefaultAsyncRunnableExecutionExceptionHandler - Job 103 failed
org.flowable.common.engine.api.FlowableOptimisticLockingException: ProcessInstance[95] was updated by another transaction concurrently
…
at java.lang.Thread.run(Thread.java:748)
Thu May 09 11:29:39 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:29:49 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:29:49 CEST 2019 LAST STEP 5@@@@@@@@@@ TEST_JUNIT_PARALLEL_ASYNC
Thu May 09 11:29:09 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:29:09 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:29:12 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:29:12 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:29:12 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:29:19 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:29:19 CEST 2019 LAST STEP 5@@@@@@@@@@ TEST_JUNIT_PARALLEL_ASYNC_EXCLUSIVE
Thu May 09 11:29:50 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:29:50 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:29:53 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:29:53 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:29:53 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:30:00 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:30:00 CEST 2019 LAST STEP 5@@@@@@@@@@ TEST_JUNIT_INCLUSIVE_SYNC
Thu May 09 11:30:31 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:30:31 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:30:34 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:30:34 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:30:34 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:30:41 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:30:41 CEST 2019 LAST STEP 511:30:41,208 [flowable-async-job-executor-thread-2] ERROR org.flowable.job.service.impl.asyncexecutor.DefaultAsyncRunnableExecutionExceptionHandler - Job 194 failed
org.flowable.common.engine.api.FlowableOptimisticLockingException: ProcessInstance[186] was updated by another transaction concurrently
…
at java.lang.Thread.run(Thread.java:748)
Thu May 09 11:30:51 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:31:01 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:31:01 CEST 2019 LAST STEP 5@@@@@@@@@@ TEST_JUNIT_INCLUSIVE_SYNC_EXCLUSIVE
Thu May 09 11:28:07 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:28:07 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:28:10 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:28:10 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:28:10 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:28:17 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:28:17 CEST 2019 LAST STEP 511:28:17,203 [flowable-async-job-executor-thread-2] ERROR org.flowable.job.service.impl.asyncexecutor.DefaultAsyncRunnableExecutionExceptionHandler - Job 13 failed
org.flowable.common.engine.api.FlowableOptimisticLockingException: ProcessInstance[5] was updated by another transaction concurrently
…
at java.lang.Thread.run(Thread.java:748)**
Thu May 09 11:28:27 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:28:37 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:28:37 CEST 2019 LAST STEP 5@@@@@@@@@@ TEST_JUNIT_INCLUSIVE_ASYNC
Thu May 09 11:31:02 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:31:02 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:31:05 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:31:05 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:31:05 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:31:12 CEST 2019 ASYNC Step3 - execution after sleep
11:31:12,264 [flowable-async-job-executor-thread-1] ERROR org.flowable.job.service.impl.asyncexecutor.DefaultAsyncRunnableExecutionExceptionHandler - Job 225 failed
org.flowable.common.engine.api.FlowableOptimisticLockingException: ProcessInstance[217] was updated by another transaction concurrently
…
at java.lang.Thread.run(Thread.java:748)
Thu May 09 11:31:22 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:31:32 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:31:32 CEST 2019 LAST STEP 5@@@@@@@@@@ TEST_JUNIT_INCLUSIVE_ASYNC_EXCLUSIVE
Thu May 09 11:30:00 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:30:00 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:30:03 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:30:03 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:30:03 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:30:10 CEST 2019 ASYNC Step3 - execution after sleep
11:30:10,571 [flowable-async-job-executor-thread-1] ERROR org.flowable.job.service.impl.asyncexecutor.DefaultAsyncRunnableExecutionExceptionHandler - Job 162 failed
org.flowable.common.engine.api.FlowableOptimisticLockingException: ProcessInstance[154] was updated by another transaction concurrently
…
at java.lang.Thread.run(Thread.java:748)
Thu May 09 11:30:20 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:30:30 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:30:30 CEST 2019 LAST STEP 5Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 210.093 sec
What is strange to me is that we do not get the same result with parallel and inclusive gateways.
With Parallel gateway, we have 2 scenarios without OptimisticLock exception.
But with Inclusive gateway, all scenarios generate an OptimisticLock exception!..
And it’s really problematic (to me at least :)).
I don’t know how to upload the project with the corresponding JUnit tests (and BPMN files)
Best Regards
William.