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
I don't think that DbIdGenerator is the issue but you can try switching to UUID instead see Activiti User Guide
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
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.