apache / incubator-kie-kogito-runtimes

Kogito Runtimes - Kogito is a cloud-native business automation technology for building cloud-ready business applications.
http://kogito.kie.org
Apache License 2.0
540 stars 209 forks source link

Timer embedded in Multi Instance subprocess never finishes execution #2054

Open sethhoward opened 2 years ago

sethhoward commented 2 years ago

Describe the bug

image

The above diagram creates multiple instance subprocesses with an embedded timer running at PT3S. The instances appear to run indefinitely and the entire process never finishes.

The Multi Instance is running parallel.

Expected behavior

Instantiating three subprocesses should result in the following output:

Starting [{drinkType=string, cupSize=string, orderPrice=0}, {drinkType=string, cupSize=string, orderPrice=1}, {drinkType=string, cupSize=string, orderPrice=2}]
Processing {drinkType=string, cupSize=string, orderPrice=0}
Processing {drinkType=string, cupSize=string, orderPrice=1}
Processing {drinkType=string, cupSize=string, orderPrice=2}
2022-03-02 13:59:59,455 INFO  [org.kie.ser.job.imp.InMemoryJobService] (pool-19-thread-1) Job TIMER:0:596cb1e1-ee08-477c-bb7e-288c8ad0ada9 started
2022-03-02 13:59:59,458 INFO  [org.kie.ser.job.imp.InMemoryJobService] (pool-19-thread-2) Job TIMER:0:dfaa7725-3cdd-46bf-9ab6-8ab56c3ace87 started
2022-03-02 13:59:59,459 INFO  [org.kie.ser.job.imp.InMemoryJobService] (pool-19-thread-3) Job TIMER:0:c35a212d-3146-48d6-9537-812ca1b39a67 started
End
End
End
Complete

Actual behavior

Running the process would appear to never complete:

Starting [{drinkType=string, cupSize=string, orderPrice=0}, {drinkType=string, cupSize=string, orderPrice=1}, {drinkType=string, cupSize=string, orderPrice=2}]
Processing {drinkType=string, cupSize=string, orderPrice=0}
Processing {drinkType=string, cupSize=string, orderPrice=1}
Processing {drinkType=string, cupSize=string, orderPrice=2}
2022-03-02 13:59:59,455 INFO  [org.kie.ser.job.imp.InMemoryJobService] (pool-19-thread-1) Job TIMER:0:596cb1e1-ee08-477c-bb7e-288c8ad0ada9 started
2022-03-02 13:59:59,458 INFO  [org.kie.ser.job.imp.InMemoryJobService] (pool-19-thread-2) Job TIMER:0:dfaa7725-3cdd-46bf-9ab6-8ab56c3ace87 started
2022-03-02 13:59:59,459 INFO  [org.kie.ser.job.imp.InMemoryJobService] (pool-19-thread-3) Job TIMER:0:c35a212d-3146-48d6-9537-812ca1b39a67 started
End
End
End

The Complete task is never called.

Removing the timer or setting the instance to Sequential or Async (which behaves exactly like Sequential) produces the appropriate result:

Starting [{drinkType=string, cupSize=string, orderPrice=0}, {drinkType=string, cupSize=string, orderPrice=1}, {drinkType=string, cupSize=string, orderPrice=2}]
Processing {drinkType=string, cupSize=string, orderPrice=0}
2022-03-02 14:11:10,853 INFO  [org.kie.ser.job.imp.InMemoryJobService] (pool-46-thread-1) Job TIMER:0:1722d704-8a5f-4e09-b673-dc3d387ab565 started
End
Processing {drinkType=string, cupSize=string, orderPrice=2}
2022-03-02 14:11:13,863 INFO  [org.kie.ser.job.imp.InMemoryJobService] (pool-46-thread-2) Job TIMER:0:ed3d978f-d4d7-40d9-b658-27ebe835b352 started
End
Processing {drinkType=string, cupSize=string, orderPrice=1}
2022-03-02 14:11:16,870 INFO  [org.kie.ser.job.imp.InMemoryJobService] (pool-46-thread-1) Job TIMER:0:41933937-3385-4972-ace0-1d37d4cec1a5 started
End
Complete 

How to Reproduce?

line-test-kogito.zip

Using the multiprocess.bpmn2

Output of uname -a or ver

No response

Output of java -version

jdk-11

GraalVM version (if different from Java)

No response

Kogito version or git rev (or at least Quarkus version if you are using Kogito via Quarkus platform BOM)

1.17.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

tiagodolphine commented 2 years ago

Tracking the issue on https://issues.redhat.com/browse/KOGITO-6847