cancel
Showing results for 
Search instead for 
Did you mean: 

Bug with concurrentExecution

swamy2156
Champ on-the-rise
Champ on-the-rise
Hi,

I am using Activiti 5.17 and facing concurrent execution problem in my workflow seems like a activiti bug to me. I am working on a real time scenario like, there will be 8 parallel user tasks attached with boundary timer and service task. I am passing expression to the each service task. All these service tasks will be triggered at the same time. Some times, I notice that few service tasks reading other serviceTask's expression and doing false execution.

I am trying to isolate this problem with a junit test case and attaching to this ticket. In this test case, Initially, I turned OFF "jobExecutorActivate" and ran the test case ProcessTestMyProcess1.java so, there will be 8 jobs active in ACT_RU_JOB table, now, turn ON "jobExecutorActivate" and run it. It will execute all 16 jobs and should print 2 statements for each service task but, which is not happening. For few service tasks printing other service task related expression data.

(attached my test case maven module. please rename .txt to .zip and extract it to see the files.) Please change the db urls

Thanks,
Swamy.
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
I tested your project, you have a misconfiguration in your logging. The moment I added slf4j-api as a dependency, I could see

01:49:54,706 [pool-1-thread-2] INFO  com.uprr.activiti.practice.spring.SimpleServiceTask  - This is called from ServiceTask : Service Task3
01:49:54,706 [pool-1-thread-1] INFO  com.uprr.activiti.practice.spring.SimpleServiceTask  - This is called from ServiceTask : Service Task3

swamy2156
Champ on-the-rise
Champ on-the-rise
Thank you Joram for your reply. But, My observation is different and described as follows.

When I run second time by turning ON jobExecutorActivate, I got the following log. If you see first 8 lines printed by pending jobs for previous instance. and last 8 lines are for 2nd process instance. If you see first 2 lines in first set, pool-1-thread-2 & pool-1-thread-1 read same expression and ServiceTask1 form property passed from bpmn model never used. Some times, 3 threads reads same expression though I pass different in service task properties in bpmn. For me, in real time, I am triggering mail from each service task. In this case, instead of ServiceTask1 related mail, I am receiving service task2 mail for twice.

[09:31:21.023]::INFO :Smiley Tongueool-1-thread-2::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task2
[09:31:21.023]::INFO :Smiley Tongueool-1-thread-1::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task2
[09:31:21.027]::INFO :Smiley Tongueool-1-thread-5::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task8
[09:31:21.031]::INFO :Smiley Tongueool-1-thread-4::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task7
[09:31:21.041]::INFO :Smiley Tongueool-1-thread-3::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task3
[09:31:21.087]::INFO :Smiley Tongueool-1-thread-5::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task4
[09:31:21.102]::INFO :Smiley Tongueool-1-thread-4::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task5
[09:31:21.114]::INFO :Smiley Tongueool-1-thread-2::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task6

[09:31:30.908]::INFO :Smiley Tongueool-1-thread-5::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task1
[09:31:30.918]::INFO :Smiley Tongueool-1-thread-4::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task2
[09:31:30.931]::INFO :Smiley Tongueool-1-thread-2::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task3
[09:31:30.954]::INFO :Smiley Tongueool-1-thread-5::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task4
[09:31:30.971]::INFO :Smiley Tongueool-1-thread-4::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task5
[09:31:30.990]::INFO :Smiley Tongueool-1-thread-2::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task6
[09:31:31.014]::INFO :Smiley Tongueool-1-thread-5::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task7
[09:31:31.039]::INFO :Smiley Tongueool-1-thread-4::com.uprr.activiti.practice.spring.SimpleServiceTask:16 - This is called from ServiceTask : Service Task8

Can't we use DelegateExpressions with fields in ServiceTasks in parallel flow?

thanks,
swamy.

jbarrez
Star Contributor
Star Contributor
Not sure I'm following here … but looking at the threads that execute the logic is saying not a lot - maybe it's a thread pool configuration thing, maybe it's a hardware kind of thing.
The easiest would be if you have a unit test that clearly demonstrates the problem you see.