pefernan opened a new issue, #7332: URL: https://github.com/apache/incubator-kie/issues/7332
### Describe the bug **Describe the bug** The code generator puts both `@jakarta.transaction.Transactional` and `@org.eclipse.microprofile.faulttolerance.Retry` on every method of the generated process resources (ProcessResourceGenerator.manageTransactional / manageFaultTolerance) and the user task resource (UserTaskCodegen.manageTransactional / manageFaultTolerance). The retry is on by default. `kogito.faultToleranceEnabled` defaults to true, and _quarkus-smallrye-fault-tolerance_ is on the classpath through jbpm-quarkus. CDI orders interceptors by priority, lowest outermost. Narayana's _TransactionalInterceptorRequired_ has priority 200 and SmallRye's _FaultToleranceInterceptor_ has priority 4010. So the transaction begins once, around the retry, and every attempt runs inside the same JTA transaction. A failed attempt is not rolled back, because the unit of work only aborts the engine's state and leaves the JTA transaction alone. With JDBC persistence the failed attempt's rows are already written. The retry then runs on top of them and the transaction commits everything together. **Actual behavior** When two transitions of one process instance run at the same time, for example two user tasks completed on two replicas: - The losing transition's first attempt starts a child process (call activity), then fails the optimistic lock check with ProcessInstanceOptimisticLockingException. - `@Retry` re-runs the transition in the same transaction. It starts a second child process and the parent write now succeeds. - The transaction commits both children, and the caller gets 200. The parent references only one child. The other child is orphaned and keeps running. **Other effects:** - Row locks taken by the failed attempt are held through the retry jitter and the later attempts. - @Retry retries every Exception: missing tasks, validation errors and so on, each run 4 times. - If the first failure is an SQL error, PostgreSQL aborts the transaction. The 3 retries then fail with current transaction is aborted, commands ignored until end of transaction block (25P02), the request returns 500, and the real cause only appears at the bottom of the stack trace. Expected behavior Each attempt runs in its own transaction. A failed attempt is rolled back and its locks released before the next one starts. Only failures a retry can resolve (a lost optimistic lock) are retried. ### Expected behavior _No response_ ### 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_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
