Flowable task complete issue - UserTask should not be signalled before complete

Hi,

We are facing below issue details:-

Prerequisite:-
We are using flowable version 6.6.0 as a dependency in spring boot application.

Problem statement:-
We are getting a issue “UserTask should not be signalled before complete" while completing a specific stage.
We have a BPM flow refer below flow diagram just for reference.

in which sometimes while completing a “E” stage which is after few parallel stages(“B”, “C”), we are facing an issue “UserTask should not be signalled before complete” in BPM logs

java.lang.Exception: UserTask should not be signalled before complete
       at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
       at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
       at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749)
       at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:366)
       at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
       at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749)
       at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691)
       at sun.reflect.GeneratedMethodAccessor777.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)

Temporary Solution:-
We have analysed the issue and found a temporary solution that in “ACT_RU_TASK” table we get multiple records for that task.
SELECT * FROM ACT_RU_TASK art WHERE PROC_INST_ID_ =‘PROCESS_INSTANCE_ID’
We were able to complete the stage “E” after removing those multiple records and keeping a single record in “ACT_RU_TASK” table.

We are looking after the root cause of this problem and need a permanent solution.

That particular exception is thrown here: https://github.com/flowable/flowable-engine/blob/main/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java#L322

and it happens when trying to complete a task, when it’s aready been completed during the same transaction. Are you deleting the process instances potentially beforehand or simultaneously?

Note sure what this means, can you clarify?

Hi,

We are not deleting the process instances potentially refer below code that we are using for completing task.

taskService.complete(TASK_ID,VARIABLES)

We found that there were two records in “ACT_RU_TASK” table when we got this issue.

So after deleting previous records we are able to complete task.