Missing variable in parallel task execution

Hello,
I have a simple process with three service tasks. The second and third one have “Asynchronous before” option enabled and they are parallel.
In the first service task, I have one output variable named “foo”. The problem is that after parallel gateway only one service task gets access to it, the other one doesn’t know anything about it.
If I initiate this variable in the beginning of the process, then everything goes fine. But this is not the solution I’m looking for, there are a lot of variables and parallel gateways in our production code.
And I don’t understand why this is happening. Looks like a bug to me.

exec_test.bpmn (6.4 KB)

Can you put async before on the first gateway? If you add user tasks before Service Task 2 and 3, can you manually check the scope in cockpit when its waiting?

I did and nothing changed

You need to add the user task before your 2 and 3 but AFTER the gateway. So you are adding 2 user tasks. THe point is to eval what variables are in what scopes once you go into async and are running multiple executions.

Yes, I did that too
Service user task 2 doesn’t have any variables and user task 3 has a scope with “foo” variable

THis is with async after placed on your first gateway?

Yes
I’ve tried async after, async before and both of them simultaneously, result always the same

Looks like you have something wrong with your setup:

asyncTest.bpmn (6.6 KB)

To reproduce this behavior, you need to assign foo variable through output parameter and you need to check async before on both parallel tasks.

If you are setting variable using execution.setVariable somewere before parallel gateway, then everything will be fine.

But I can’t do this (well, I can, but this is very tedious and cumbersome in my case), almost all my server tasks are asynchronous and all of them map their parameters through input/output.

So if i set async before on the user tasks, and change my output mapping on task 1 to be just title: foo, value: myValue, and re run it still works as expected.

asyncTest.bpmn (6.7 KB)

It’s because you are using input parameters instead of output

Can you modify my bpmn with the config that causes the error

Here is a updated version that updates with Output variables and when it reaches task 4, the outputs are as expected.

asyncTest.bpmn (6.8 KB)

1 Like

This is very strange
I can’t reach task 4
I can only complete one user task (the second one) and on completing the third one I’m getting the exception as before
ProcessEngineException: Cannot find serializer for value 'Untyped value

I’m using camunda-bpm-spring-boot-starter-webapp:2.0.0 with camunda-engine:7.6.0 (same with 7.7.0)
Just now I downloaded camunda-bpm-tomcat-7.10.0.zip and it’s works perfectly
Maybe I should update version of camunda-engine in my application

If you are still using 7.6 then yes upgrade… If you can move to 7.10 all the better