Duplicate Active User Task Issue

Hi everyone,

I have encountered a bug in my client’s production environment, in summary we are getting duplicate key value violates unique constraint “act-ru-actinst_pkey” which showed me that there is 2 active tasks running and assigned to the same user here is the exception from flowable engine (Version 6.7.1) :\

I tried to complete one of the tasks using flowable-gui but I get the same error but in the flowable-gui deployment. I noticed that this duplications happens randomly after a mail task and I have many mail tasks in this model, I tried to reproduce this duplication but no success. I thought it could be after a mail sending failure but no success.

Note: I cannot access production environment only backend logs, and I couldn’t reproduce this bug. this client is really sensitive about his data

Ask me for any further specifications and I appreciate any advice or assistance you can provide. Thank you in advance for your help.

2 Likes

Hello Have you managed to resolve the issue?
I’m having the same behavior and it happens randomly I can’t figure out the exact scenario.

1 Like

Hi @hberrayana, I am sorry to hear that you are experiencing the same issue. But throughout my attempts trying to recreate the scenario, I had some doubt about having multiple backend instances that run flowable engine, as well as asynchronous activities too. Because some time ago I was testing asynchronous service tasks, I kept getting duplicate User Tasks.

Note : Asynchronous tasks are set to the database de be handled later with the first available instance connected to the flowable database.

I Have been getting this error this past few days [UserTask should not be signalled before complete] any ideas ?

Hi,
I’m using the version 7.0.0 and the same issue has surfaced (there are 2 active tasks running). Multi-instance type for the user task is set to “None”. The issue has happened just on random basis and its not reproducible. Would really appreciate if you got any hints about it. Thank you.

1 Like

This is the by-product of the duplicated active tasks. For me, deleting the additional task has fixed the issue. The thing that is not clear at the moment is what causes this duplicate active task(s).
delete from ACT_RU_IDENTITYLINK where task_id_ = ‘task–id’ ;
delete from FLOWABLE.act_ru_task where id_ = ‘task–id’ ;

Hey @circle,

Are you getting some exception? Can you share the stacktrace?

Having a non multi instance twice is strange and completely unexpected.

Cheers,
Filip

1 Like

Hi @filiphr, Thank you very much. Unfortunately when the duplicate active tasks got created, no logs related were found. The exceptions came later when we try to claim the task or execute the task. Please see them below.

For Claim Task:

{
   "instant":{
      "epochSecond":1724155000,
      "nanoOfSecond":620888230
   },
   "thread":"https-jsse-nio-8080-exec-9",
   "level":"ERROR",
   "loggerName":"org.flowable.common.engine.impl.interceptor.CommandContext",
   "message":"Error while closing command context",
   "thrown":{
      "commonElementCount":0,
      "localizedMessage":"\n### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (FLOWABLE.SYS_C008559) violated\n\n### The error may exist in org/flowable/db/mapping/entity/ActivityInstance.xml\n### The error may involve org.flowable.engine.impl.persistence.entity.ActivityInstanceEntityImpl.insertActivityInstance-Inline\n### The error occurred while setting parameters\n### SQL: insert into ACT_RU_ACTINST (         ID_,         REV_,         PROC_DEF_ID_,         PROC_INST_ID_,         EXECUTION_ID_,         ACT_ID_,         TASK_ID_,         CALL_PROC_INST_ID_,         ACT_NAME_,         ACT_TYPE_,         ASSIGNEE_,         START_TIME_,         END_TIME_,         TRANSACTION_ORDER_,         DURATION_,         DELETE_REASON_,         TENANT_ID_       ) values (         ?,         1, ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?       )\n### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (FLOWABLE.SYS_C008559) violated\n",
      "message":"\n### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (FLOWABLE.SYS_C008559) violated\n\n### The error may exist in org/flowable/db/mapping/entity/ActivityInstance.xml\n### The error may involve org.flowable.engine.impl.persistence.entity.ActivityInstanceEntityImpl.insertActivityInstance-Inline\n### The error occurred while setting parameters\n### SQL: insert into ACT_RU_ACTINST (         ID_,         REV_,         PROC_DEF_ID_,         PROC_INST_ID_,         EXECUTION_ID_,         ACT_ID_,         TASK_ID_,         CALL_PROC_INST_ID_,         ACT_NAME_,         ACT_TYPE_,         ASSIGNEE_,         START_TIME_,         END_TIME_,         TRANSACTION_ORDER_,         DURATION_,         DELETE_REASON_,         TENANT_ID_       ) values (         ?,         1, ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?,         ?       )\n### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (FLOWABLE.SYS_C008559) violated\n",
      "name":"org.apache.ibatis.exceptions.PersistenceException",
      "cause":{
         "commonElementCount":193,
         "localizedMessage":"ORA-00001: unique constraint (FLOWABLE.SYS_C008559) violated\n",
         "message":"ORA-00001: unique constraint (FLOWABLE.SYS_C008559) violated\n",
         "name":"java.sql.SQLIntegrityConstraintViolationException",
         "cause":{
            "commonElementCount":193,
            "localizedMessage":"ORA-00001: unique constraint (FLOWABLE.SYS_C008559) violated\n",
            "message":"ORA-00001: unique constraint (FLOWABLE.SYS_C008559) violated\n",
            "name":"oracle.jdbc.OracleDatabaseException",
            "extendedStackTrace":[
               {
                  "class":"oracle.jdbc.driver.T4CTTIoer11",
                  "method":"processError",
                  "file":"T4CTTIoer11.java",
                  "line":513,
                  "exact":false,
                  "location":"ojdbc10-19.18.0.0.jar!/",
                  "version":"19.18.0.0.0"
               },
               {
                  "class":"oracle.jdbc.driver.T4CTTIoer11",
                  "method":"processError",
                  "file":"T4CTTIoer11.java",
                  "line":461,
                  "exact":false,
                  "location":"ojdbc10-19.18.0.0.jar!/",
                  "version":"19.18.0.0.0"
               },
               {
                  "class":"oracle.jdbc.driver.T4C8Oall",
                  "method":"processError",
                  "file":"T4C8Oall.java",
                  "line":1104,
                  "exact":false,
                  "location":"ojdbc10-19.18.0.0.jar!/",
                  "version":"19.18.0.0.0"
               },
               {
                  "class":"oracle.jdbc.driver.T4CTTIfun",
                  "method":"receive",
                  "file":"T4CTTIfun.java",
                  "line":553,
                  "exact":false,
                  "location":"ojdbc10-19.18.0.0.jar!/",
                  "version":"19.18.0.0.0"
               }

For task execution:

{

   "thread":"https-jsse-nio-8080-exec-1",
   "level":"ERROR",
   "message":"FlowableException caught",
   "thrown":{
      "commonElementCount":0,
      "localizedMessage":"UserTask should not be signalled before complete",
      "message":"UserTask should not be signalled before complete",
      "name":"org.flowable.common.engine.api.FlowableException",
      "extendedStackTrace":[
         {
            "class":"org.flowable.engine.impl.bpmn.behavior.UserTaskActivityBehavior",
            "method":"trigger",
            "file":"UserTaskActivityBehavior.java",
            "line":322,
            "exact":false,
            "location":"flowable-engine-7.0.0.jar!/",
            "version":"7.0.0"
         },
         {
            "class":"org.flowable.engine.impl.agenda.TriggerExecutionOperation",
            "method":"run",
            "file":"TriggerExecutionOperation.java",
            "line":59,
            "exact":false,
            "location":"flowable-engine-7.0.0.jar!/",
            "version":"7.0.0"
         },
         {
            "class":"org.flowable.common.engine.impl.AbstractEngineConfiguration",
            "method":"lambda$new$0",
            "file":"AbstractEngineConfiguration.java",
            "line":195,
            "exact":false,
            "location":"flowable-engine-common-7.0.0.jar!/",
            "version":"7.0.0"
         },
         {
            "class":"org.flowable.engine.impl.interceptor.CommandInvoker",
            "method":"executeOperation",
            "file":"CommandInvoker.java",
            "line":130,
            "exact":false,
            "location":"flowable-engine-7.0.0.jar!/",
            "version":"7.0.0"
         },
         {
            "class":"org.flowable.engine.impl.interceptor.CommandInvoker",
            "method":"executeOperations",
            "file":"CommandInvoker.java",
            "line":114,
            "exact":false,
            "location":"flowable-engine-7.0.0.jar!/",
            "version":"7.0.0"
         },
         {
            "class":"org.flowable.engine.impl.interceptor.CommandInvoker",
            "method":"execute",
            "file":"CommandInvoker.java",
            "line":72,
            "exact":false,
            "location":"flowable-engine-7.0.0.jar!/",
            "version":"7.0.0"
         },
         {
            "class":"org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor",
            "method":"execute",
            "file":"BpmnOverrideContextInterceptor.java",
            "line":26,
            "exact":false,
            "location":"flowable-engine-7.0.0.jar!/",
            "version":"7.0.0"
         },
         {
            "class":"org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor",
            "method":"execute",
            "file":"TransactionContextInterceptor.java",
            "line":53,
            "exact":false,
            "location":"flowable-engine-common-7.0.0.jar!/",
            "version":"7.0.0"
         },
         {
            "class":"org.flowable.common.engine.impl.interceptor.CommandContextInterceptor",
            "method":"execute",
            "file":"CommandContextInterceptor.java",
            "line":105,
            "exact":false,
            "location":"flowable-engine-common-7.0.0.jar!/",
            "version":"7.0.0"
         },
         {
            "class":"org.flowable.common.spring.SpringTransactionInterceptor",
            "method":"execute",
            "file":"SpringTransactionInterceptor.java",
            "line":52,
            "exact":false,
            "location":"flowable-spring-common-7.0.0.jar!/",
            "version":"7.0.0"
         },
         {
            "class":"org.flowable.common.engine.impl.interceptor.LogInterceptor",
            "method":"execute",
            "file":"LogInterceptor.java",
            "line":30,
            "exact":false,
            "location":"flowable-engine-common-7.0.0.jar!/",
            "version":"7.0.0"
         },
         {
            "class":"org.flowable.common.engine.impl.cfg.CommandExecutorImpl",
            "method":"execute",
            "file":"CommandExecutorImpl.java",
            "line":56,
            "exact":false,
            "location":"flowable-engine-common-7.0.0.jar!/",
            "version":"7.0.0"
         },
         {
            "class":"org.flowable.common.engine.impl.cfg.CommandExecutorImpl",
            "method":"execute",
            "file":"CommandExecutorImpl.java",
            "line":51,
            "exact":false,
            "location":"flowable-engine-common-7.0.0.jar!/",
            "version":"7.0.0"
         },
         {
            "class":"org.flowable.engine.impl.TaskServiceImpl",
            "method":"complete",
            "file":"TaskServiceImpl.java",
            "line":223,
            "exact":false,
            "location":"flowable-engine-7.0.0.jar!/",
            "version":"7.0.0"
         }

@circle have you come to any conclusion or found any systematic pattern to replicate the task duplication.

Just to mention the exception we are getting is in this class UserTaskActivityBehavior.java:Line 336