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
491 stars 192 forks source link

The Event state creates two jobs #3524

Closed wmedvede closed 1 month ago

wmedvede commented 1 month ago

Describe the bug

1) Execute for example event-state-timeouts the serverless-workflow-timeouts-showcase-embedded but setting the log level with: quarkus.log.category."org.kie.kogito.jobs".level=DEBUG

2) When a new workflow instance is created in the logs we can see:

2024-05-19 10:19:13,818 wmedvede DEBUG [org.kie.kogito.jobs.management.quarkus.VertxJobsService:100] (executor-thread-1) Job to be scheduled ProcessInstanceJobDescription{id='5983c68e-d645-4d4f-a84c-2b0c80ca5f7a', timerId=-1', expirationTime=org.kie.kogito.jobs.DurationExpirationTime@5b8f5b79, priority=5, processInstanceId='1dc41c90-16e3-4a87-a911-0fcee6adddb5', rootProcessInstanceId='null', processId='event_state_timeouts', rootProcessId='null', nodeInstanceId='d09b6c6f-92c0-4435-b5c0-995788be8a7a'} with callback URL http://localhost:8080/management/jobs/event_state_timeouts/instances/1dc41c90-16e3-4a87-a911-0fcee6adddb5/timers/-1

2024-05-19 10:19:13,846 wmedvede DEBUG [org.kie.kogito.jobs.management.quarkus.VertxJobsService:100] (executor-thread-1) Job to be scheduled ProcessInstanceJobDescription{id='dc4bf46c-3f15-49c3-9cc3-9b1fc9a0904e', timerId=-1', expirationTime=org.kie.kogito.jobs.DurationExpirationTime@89d00e5, priority=5, processInstanceId='1dc41c90-16e3-4a87-a911-0fcee6adddb5', rootProcessInstanceId='null', processId='event_state_timeouts', rootProcessId='null', nodeInstanceId='f5a79e62-f7d8-495b-a79c-36ab90ca80f2'} with callback URL http://localhost:8080/management/jobs/event_state_timeouts/instances/1dc41c90-16e3-4a87-a911-0fcee6adddb5/timers/-1

3) What we can see is that two jobs where created, this is the bug.

Full execution log here:

https://gist.github.com/wmedvede/932a4e68057fa69b7efa13442ac75eff

When the job is finally fired, will see that the first job is executed, and the process finishes as expected. When the process finishes, the second job is automatically cancelled, and at some point in the execution, the jobs service prints a controlled error. This is because the second job was canceled as part of the process finalization at the same time it was executing. But this is a controlled error.

Expected behavior

Only one job should be created.

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

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)

No response

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

No response

Additional information

No response