03-21-2018 04:45 PM
Hi,
I'm using Activiti 5.22.0, and I occasionally encounter the following exception when trying to complete a task:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "act_hi_detail_pkey"
Detail: Key (id_)=(5096) already exists.
### The error may involve org.activiti.engine.impl.persistence.entity.HistoricDetailEntity.insertHistoricDetailVariableInstanceUpdate-Inline
### The error occurred while setting parameters
### SQL: insert into ACT_HI_DETAIL (ID_, TYPE_, PROC_INST_ID_, EXECUTION_ID_, ACT_INST_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, TIME_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_) values ( ?, 'VariableUpdate', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "act_hi_detail_pkey"
I cannot reproduce this consistently, and the issue resolves on reinitialization of Activiti (a restart of the application server), because another block of 2500 IDs is retrieved. I am guessing that for some reason the value retrieved from org.activiti.engine.impl.db.DbIdGenerator is in conflict with an ID that already exists in the act_hi_detail table.
Any ideas what is causing this issue, or what can be done to prevent it from happening? Has this issue been fixed in more recent versions?
Thanks
03-22-2018 09:54 AM
I don't think that DbIdGenerator is the issue but you can try switching to UUID instead see Activiti User Guide
07-06-2020 07:41 AM
Recently we faced this issue on Alfresco Community 6.1.x. The problem is about the incorrect ID generator (newly generated ID is already in the database).
To fix this issue you have to change next.dbid value in the database.
Step-by-step:
1) Check maximum id value
id_ select max(to_number(id_,'999999999')) from public.act_hi_detail
2) Update value_ in the act_ge_property table - must be greater than maximum id return by the previous SQL statement
3) Restart Alfresco
Explore our Alfresco products with the links below. Use labels to filter content by product module.