# Duplicate Active User Task Issue

**URL:** <https://forum.flowable.org/t/duplicate-active-user-task-issue/10444>\
**Category:** Flowable Engine\
**Created:** [April 24, 2023, 2:54pm UTC](https://forum.flowable.org/t/duplicate-active-user-task-issue/10444 "2023-04-24T14:54:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Makros-24](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/makros-24/32/3150_2.png) [@Makros-24](https://forum.flowable.org/u/Makros-24)\
**Post date:** [April 24, 2023, 2:54pm UTC](https://forum.flowable.org/t/duplicate-active-user-task-issue/10444/1 "2023-04-24T14:54:34Z")

</div>

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** ) :\

 ![MicrosoftTeams-image (16)](https://canada1.discourse-cdn.com/flex035/uploads/flowable/original/2X/5/5b70e2a12ee7542f39301050edc291316c2e94a9.png)

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.

---

<div class="post-metadata">

**Author:** ![hberrayana](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/hberrayana/32/2670_2.png) [@hberrayana](https://forum.flowable.org/u/hberrayana)\
**Post date:** [May 15, 2023, 8:30am UTC](https://forum.flowable.org/t/duplicate-active-user-task-issue/10444/2 "2023-05-15T08:30:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Makros-24](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/makros-24/32/3150_2.png) [@Makros-24](https://forum.flowable.org/u/Makros-24)\
**Post date:** [May 15, 2023, 11:02am UTC](https://forum.flowable.org/t/duplicate-active-user-task-issue/10444/3 "2023-05-15T11:02:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Makros-24](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/makros-24/32/3150_2.png) [@Makros-24](https://forum.flowable.org/u/Makros-24)\
**Post date:** [June 2, 2023, 11:57am UTC](https://forum.flowable.org/t/duplicate-active-user-task-issue/10444/4 "2023-06-02T11:57:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![circle](https://avatars.discourse-cdn.com/v4/letter/c/7993a0/32.png) [@circle](https://forum.flowable.org/u/circle)\
**Post date:** [August 22, 2024, 4:08am UTC](https://forum.flowable.org/t/duplicate-active-user-task-issue/10444/5 "2024-08-22T04:08:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![circle](https://avatars.discourse-cdn.com/v4/letter/c/7993a0/32.png) [@circle](https://forum.flowable.org/u/circle)\
**Post date:** [August 22, 2024, 4:40am UTC](https://forum.flowable.org/t/duplicate-active-user-task-issue/10444/6 "2024-08-22T04:40:10Z")

</div>

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’ ;

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [August 22, 2024, 6:10am UTC](https://forum.flowable.org/t/duplicate-active-user-task-issue/10444/7 "2024-08-22T06:10:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![circle](https://avatars.discourse-cdn.com/v4/letter/c/7993a0/32.png) [@circle](https://forum.flowable.org/u/circle)\
**Post date:** [August 22, 2024, 8:45am UTC](https://forum.flowable.org/t/duplicate-active-user-task-issue/10444/8 "2024-08-22T08:45:30Z")

</div>

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:

```auto
{
   "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:

```auto
{

   "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"
         }

```

---

<div class="post-metadata">

**Author:** ![Makros-24](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/makros-24/32/3150_2.png) [@Makros-24](https://forum.flowable.org/u/Makros-24)\
**Post date:** [November 29, 2024, 9:35am UTC](https://forum.flowable.org/t/duplicate-active-user-task-issue/10444/9 "2024-11-29T09:35:11Z")

</div>

@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](https://github.com/flowable/flowable-engine/blob/main/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java):Line 336
