Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-10931

Migration of a process instance waiting in an async start event fails with unique constraint violation

XMLWordPrintable

      Steps to reproduce:

      1. Deploy version 1 of a process containing a start event with camunda:async="true"; make sure that the job execution fails so that the process instance is waiting in the async start event
      2. Start a process instance and pass at least one variable to the process instance
        runtimeService
          .startProcessInstanceByKey(
            "key",
            Variables.createVariables().putValue("foo", "bar")
          );
        
      3. Let the job execution fail, so that an incident is created on the async start event
      4. Deploy a new version 2 of the process definition in which the job will not fail anymore
      5. Migrate the existing process instance to process definition version 2
      6. Increment retries of failed job to >= 1

      Expected behavior:
      The job should be executed successfully without any exception.

      Observed behavior:
      The job fails with a unique constraint violation exception:

      16:33:32.406 [camundaTaskExecutor-2] ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: ENGINE-03004 Exception while executing Database Operation 'INSERT HistoricVariableInstanceEntity[6]' with message '
      ### Error flushing statements.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance (batch index #1) failed. Cause: org.h2.jdbc.JdbcBatchUpdateException: Eindeutiger Index oder Primärschlüssel verletzt: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"
      Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"; SQL statement:
      insert into ACT_HI_VARINST (
            ID_,
            PROC_DEF_KEY_,
            PROC_DEF_ID_,
            ROOT_PROC_INST_ID_,
            PROC_INST_ID_,
            EXECUTION_ID_,
            ACT_INST_ID_,
            TENANT_ID_,
            CASE_DEF_KEY_,
            CASE_DEF_ID_,
            CASE_INST_ID_,
            CASE_EXECUTION_ID_,
            TASK_ID_,
            NAME_,
            REV_,
            VAR_TYPE_,
            CREATE_TIME_,
            REMOVAL_TIME_,
            BYTEARRAY_ID_,
            DOUBLE_,
            LONG_,
            TEXT_,
            TEXT2_,
            STATE_
          ) values (
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
          ) [23505-199]
      ### Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance (batch index #1) failed. Cause: org.h2.jdbc.JdbcBatchUpdateException: Eindeutiger Index oder Primärschlüssel verletzt: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"
      Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"; SQL statement:
      insert into ACT_HI_VARINST (
            ID_,
            PROC_DEF_KEY_,
            PROC_DEF_ID_,
            ROOT_PROC_INST_ID_,
            PROC_INST_ID_,
            EXECUTION_ID_,
            ACT_INST_ID_,
            TENANT_ID_,
            CASE_DEF_KEY_,
            CASE_DEF_ID_,
            CASE_INST_ID_,
            CASE_EXECUTION_ID_,
            TASK_ID_,
            NAME_,
            REV_,
            VAR_TYPE_,
            CREATE_TIME_,
            REMOVAL_TIME_,
            BYTEARRAY_ID_,
            DOUBLE_,
            LONG_,
            TEXT_,
            TEXT2_,
            STATE_
          ) values (
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
          ) [23505-199]'. Flush summary: 
       [
        INSERT HistoricVariableInstanceEntity[6]
        INSERT HistoricJobLogEventEntity[24]
        INSERT HistoricVariableUpdateEventEntity[21]
        INSERT HistoricActivityInstanceEventEntity[END:23]
        INSERT HistoricActivityInstanceEventEntity[SERVICE_TASK:22]
        INSERT HistoricActivityInstanceEventEntity[START:20]
        DELETE MessageEntity[7]
        DELETE VariableInstanceEntity[6]
        DELETE_BULK deleteByteArrayNoRevisionCheck 14
        DELETE ExecutionEntity[5]
        UPDATE HistoricProcessInstanceEventEntity[5]
      ]
      org.camunda.bpm.engine.ProcessEngineException: ENGINE-03004 Exception while executing Database Operation 'INSERT HistoricVariableInstanceEntity[6]' with message '
      ### Error flushing statements.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance (batch index #1) failed. Cause: org.h2.jdbc.JdbcBatchUpdateException: Eindeutiger Index oder Primärschlüssel verletzt: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"
      Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"; SQL statement:
      insert into ACT_HI_VARINST (
            ID_,
            PROC_DEF_KEY_,
            PROC_DEF_ID_,
            ROOT_PROC_INST_ID_,
            PROC_INST_ID_,
            EXECUTION_ID_,
            ACT_INST_ID_,
            TENANT_ID_,
            CASE_DEF_KEY_,
            CASE_DEF_ID_,
            CASE_INST_ID_,
            CASE_EXECUTION_ID_,
            TASK_ID_,
            NAME_,
            REV_,
            VAR_TYPE_,
            CREATE_TIME_,
            REMOVAL_TIME_,
            BYTEARRAY_ID_,
            DOUBLE_,
            LONG_,
            TEXT_,
            TEXT2_,
            STATE_
          ) values (
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
          ) [23505-199]
      ### Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance (batch index #1) failed. Cause: org.h2.jdbc.JdbcBatchUpdateException: Eindeutiger Index oder Primärschlüssel verletzt: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"
      Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"; SQL statement:
      insert into ACT_HI_VARINST (
            ID_,
            PROC_DEF_KEY_,
            PROC_DEF_ID_,
            ROOT_PROC_INST_ID_,
            PROC_INST_ID_,
            EXECUTION_ID_,
            ACT_INST_ID_,
            TENANT_ID_,
            CASE_DEF_KEY_,
            CASE_DEF_ID_,
            CASE_INST_ID_,
            CASE_EXECUTION_ID_,
            TASK_ID_,
            NAME_,
            REV_,
            VAR_TYPE_,
            CREATE_TIME_,
            REMOVAL_TIME_,
            BYTEARRAY_ID_,
            DOUBLE_,
            LONG_,
            TEXT_,
            TEXT2_,
            STATE_
          ) values (
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
          ) [23505-199]'. Flush summary: 
       [
        INSERT HistoricVariableInstanceEntity[6]
        INSERT HistoricJobLogEventEntity[24]
        INSERT HistoricVariableUpdateEventEntity[21]
        INSERT HistoricActivityInstanceEventEntity[END:23]
        INSERT HistoricActivityInstanceEventEntity[SERVICE_TASK:22]
        INSERT HistoricActivityInstanceEventEntity[START:20]
        DELETE MessageEntity[7]
        DELETE VariableInstanceEntity[6]
        DELETE_BULK deleteByteArrayNoRevisionCheck 14
        DELETE ExecutionEntity[5]
        UPDATE HistoricProcessInstanceEventEntity[5]
      ]
      	at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.flushDbOperationException(EnginePersistenceLogger.java:131)
      	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:355)
      	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:322)
      	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:294)
      	at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:263)
      	at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:186)
      	at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:119)
      	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:46)
      	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
      	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44)
      	at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
      	at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
      	at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobHelper.executeJob(ExecuteJobHelper.java:50)
      	at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:68)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: org.apache.ibatis.exceptions.PersistenceException: 
      ### Error flushing statements.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance (batch index #1) failed. Cause: org.h2.jdbc.JdbcBatchUpdateException: Eindeutiger Index oder Primärschlüssel verletzt: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"
      Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"; SQL statement:
      insert into ACT_HI_VARINST (
            ID_,
            PROC_DEF_KEY_,
            PROC_DEF_ID_,
            ROOT_PROC_INST_ID_,
            PROC_INST_ID_,
            EXECUTION_ID_,
            ACT_INST_ID_,
            TENANT_ID_,
            CASE_DEF_KEY_,
            CASE_DEF_ID_,
            CASE_INST_ID_,
            CASE_EXECUTION_ID_,
            TASK_ID_,
            NAME_,
            REV_,
            VAR_TYPE_,
            CREATE_TIME_,
            REMOVAL_TIME_,
            BYTEARRAY_ID_,
            DOUBLE_,
            LONG_,
            TEXT_,
            TEXT2_,
            STATE_
          ) values (
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
          ) [23505-199]
      ### Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance (batch index #1) failed. Cause: org.h2.jdbc.JdbcBatchUpdateException: Eindeutiger Index oder Primärschlüssel verletzt: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"
      Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"; SQL statement:
      insert into ACT_HI_VARINST (
            ID_,
            PROC_DEF_KEY_,
            PROC_DEF_ID_,
            ROOT_PROC_INST_ID_,
            PROC_INST_ID_,
            EXECUTION_ID_,
            ACT_INST_ID_,
            TENANT_ID_,
            CASE_DEF_KEY_,
            CASE_DEF_ID_,
            CASE_INST_ID_,
            CASE_EXECUTION_ID_,
            TASK_ID_,
            NAME_,
            REV_,
            VAR_TYPE_,
            CREATE_TIME_,
            REMOVAL_TIME_,
            BYTEARRAY_ID_,
            DOUBLE_,
            LONG_,
            TEXT_,
            TEXT2_,
            STATE_
          ) values (
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
          ) [23505-199]
      	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
      	at org.apache.ibatis.session.defaults.DefaultSqlSession.flushStatements(DefaultSqlSession.java:255)
      	at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.flushBatchOperations(DbSqlSession.java:320)
      	at org.camunda.bpm.engine.impl.db.sql.BatchDbSqlSession.executeDbOperations(BatchDbSqlSession.java:67)
      	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:339)
      	... 15 common frames omitted
      Caused by: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance (batch index #1) failed. Cause: org.h2.jdbc.JdbcBatchUpdateException: Eindeutiger Index oder Primärschlüssel verletzt: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"
      Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"; SQL statement:
      insert into ACT_HI_VARINST (
            ID_,
            PROC_DEF_KEY_,
            PROC_DEF_ID_,
            ROOT_PROC_INST_ID_,
            PROC_INST_ID_,
            EXECUTION_ID_,
            ACT_INST_ID_,
            TENANT_ID_,
            CASE_DEF_KEY_,
            CASE_DEF_ID_,
            CASE_INST_ID_,
            CASE_EXECUTION_ID_,
            TASK_ID_,
            NAME_,
            REV_,
            VAR_TYPE_,
            CREATE_TIME_,
            REMOVAL_TIME_,
            BYTEARRAY_ID_,
            DOUBLE_,
            LONG_,
            TEXT_,
            TEXT2_,
            STATE_
          ) values (
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
          ) [23505-199]
      	at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:146)
      	at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:129)
      	at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:122)
      	at org.apache.ibatis.executor.CachingExecutor.flushStatements(CachingExecutor.java:114)
      	at org.apache.ibatis.session.defaults.DefaultSqlSession.flushStatements(DefaultSqlSession.java:253)
      	... 18 common frames omitted
      Caused by: org.h2.jdbc.JdbcBatchUpdateException: Eindeutiger Index oder Primärschlüssel verletzt: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"
      Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"; SQL statement:
      insert into ACT_HI_VARINST (
            ID_,
            PROC_DEF_KEY_,
            PROC_DEF_ID_,
            ROOT_PROC_INST_ID_,
            PROC_INST_ID_,
            EXECUTION_ID_,
            ACT_INST_ID_,
            TENANT_ID_,
            CASE_DEF_KEY_,
            CASE_DEF_ID_,
            CASE_INST_ID_,
            CASE_EXECUTION_ID_,
            TASK_ID_,
            NAME_,
            REV_,
            VAR_TYPE_,
            CREATE_TIME_,
            REMOVAL_TIME_,
            BYTEARRAY_ID_,
            DOUBLE_,
            LONG_,
            TEXT_,
            TEXT2_,
            STATE_
          ) values (
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
          ) [23505-199]
      	at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1298)
      	at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:122)
      	... 22 common frames omitted
      16:33:32.418 [camundaTaskExecutor-2] WARN  org.camunda.bpm.engine.jobexecutor - ENGINE-14006 Exception while executing job 7: 
      org.camunda.bpm.engine.ProcessEngineException: ENGINE-03004 Exception while executing Database Operation 'INSERT HistoricVariableInstanceEntity[6]' with message '
      ### Error flushing statements.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance (batch index #1) failed. Cause: org.h2.jdbc.JdbcBatchUpdateException: Eindeutiger Index oder Primärschlüssel verletzt: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"
      Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"; SQL statement:
      insert into ACT_HI_VARINST (
            ID_,
            PROC_DEF_KEY_,
            PROC_DEF_ID_,
            ROOT_PROC_INST_ID_,
            PROC_INST_ID_,
            EXECUTION_ID_,
            ACT_INST_ID_,
            TENANT_ID_,
            CASE_DEF_KEY_,
            CASE_DEF_ID_,
            CASE_INST_ID_,
            CASE_EXECUTION_ID_,
            TASK_ID_,
            NAME_,
            REV_,
            VAR_TYPE_,
            CREATE_TIME_,
            REMOVAL_TIME_,
            BYTEARRAY_ID_,
            DOUBLE_,
            LONG_,
            TEXT_,
            TEXT2_,
            STATE_
          ) values (
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
          ) [23505-199]
      ### Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance (batch index #1) failed. Cause: org.h2.jdbc.JdbcBatchUpdateException: Eindeutiger Index oder Primärschlüssel verletzt: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"
      Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"; SQL statement:
      insert into ACT_HI_VARINST (
            ID_,
            PROC_DEF_KEY_,
            PROC_DEF_ID_,
            ROOT_PROC_INST_ID_,
            PROC_INST_ID_,
            EXECUTION_ID_,
            ACT_INST_ID_,
            TENANT_ID_,
            CASE_DEF_KEY_,
            CASE_DEF_ID_,
            CASE_INST_ID_,
            CASE_EXECUTION_ID_,
            TASK_ID_,
            NAME_,
            REV_,
            VAR_TYPE_,
            CREATE_TIME_,
            REMOVAL_TIME_,
            BYTEARRAY_ID_,
            DOUBLE_,
            LONG_,
            TEXT_,
            TEXT2_,
            STATE_
          ) values (
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
          ) [23505-199]'. Flush summary: 
       [
        INSERT HistoricVariableInstanceEntity[6]
        INSERT HistoricJobLogEventEntity[24]
        INSERT HistoricVariableUpdateEventEntity[21]
        INSERT HistoricActivityInstanceEventEntity[END:23]
        INSERT HistoricActivityInstanceEventEntity[SERVICE_TASK:22]
        INSERT HistoricActivityInstanceEventEntity[START:20]
        DELETE MessageEntity[7]
        DELETE VariableInstanceEntity[6]
        DELETE_BULK deleteByteArrayNoRevisionCheck 14
        DELETE ExecutionEntity[5]
        UPDATE HistoricProcessInstanceEventEntity[5]
      ]
      	at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.flushDbOperationException(EnginePersistenceLogger.java:131)
      	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:355)
      	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:322)
      	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:294)
      	at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:263)
      	at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:186)
      	at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:119)
      	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:46)
      	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
      	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44)
      	at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
      	at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
      	at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobHelper.executeJob(ExecuteJobHelper.java:50)
      	at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:68)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: org.apache.ibatis.exceptions.PersistenceException: 
      ### Error flushing statements.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance (batch index #1) failed. Cause: org.h2.jdbc.JdbcBatchUpdateException: Eindeutiger Index oder Primärschlüssel verletzt: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"
      Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"; SQL statement:
      insert into ACT_HI_VARINST (
            ID_,
            PROC_DEF_KEY_,
            PROC_DEF_ID_,
            ROOT_PROC_INST_ID_,
            PROC_INST_ID_,
            EXECUTION_ID_,
            ACT_INST_ID_,
            TENANT_ID_,
            CASE_DEF_KEY_,
            CASE_DEF_ID_,
            CASE_INST_ID_,
            CASE_EXECUTION_ID_,
            TASK_ID_,
            NAME_,
            REV_,
            VAR_TYPE_,
            CREATE_TIME_,
            REMOVAL_TIME_,
            BYTEARRAY_ID_,
            DOUBLE_,
            LONG_,
            TEXT_,
            TEXT2_,
            STATE_
          ) values (
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
          ) [23505-199]
      ### Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance (batch index #1) failed. Cause: org.h2.jdbc.JdbcBatchUpdateException: Eindeutiger Index oder Primärschlüssel verletzt: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"
      Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"; SQL statement:
      insert into ACT_HI_VARINST (
            ID_,
            PROC_DEF_KEY_,
            PROC_DEF_ID_,
            ROOT_PROC_INST_ID_,
            PROC_INST_ID_,
            EXECUTION_ID_,
            ACT_INST_ID_,
            TENANT_ID_,
            CASE_DEF_KEY_,
            CASE_DEF_ID_,
            CASE_INST_ID_,
            CASE_EXECUTION_ID_,
            TASK_ID_,
            NAME_,
            REV_,
            VAR_TYPE_,
            CREATE_TIME_,
            REMOVAL_TIME_,
            BYTEARRAY_ID_,
            DOUBLE_,
            LONG_,
            TEXT_,
            TEXT2_,
            STATE_
          ) values (
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
          ) [23505-199]
      	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
      	at org.apache.ibatis.session.defaults.DefaultSqlSession.flushStatements(DefaultSqlSession.java:255)
      	at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.flushBatchOperations(DbSqlSession.java:320)
      	at org.camunda.bpm.engine.impl.db.sql.BatchDbSqlSession.executeDbOperations(BatchDbSqlSession.java:67)
      	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:339)
      	... 15 common frames omitted
      Caused by: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance (batch index #1) failed. Cause: org.h2.jdbc.JdbcBatchUpdateException: Eindeutiger Index oder Primärschlüssel verletzt: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"
      Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"; SQL statement:
      insert into ACT_HI_VARINST (
            ID_,
            PROC_DEF_KEY_,
            PROC_DEF_ID_,
            ROOT_PROC_INST_ID_,
            PROC_INST_ID_,
            EXECUTION_ID_,
            ACT_INST_ID_,
            TENANT_ID_,
            CASE_DEF_KEY_,
            CASE_DEF_ID_,
            CASE_INST_ID_,
            CASE_EXECUTION_ID_,
            TASK_ID_,
            NAME_,
            REV_,
            VAR_TYPE_,
            CREATE_TIME_,
            REMOVAL_TIME_,
            BYTEARRAY_ID_,
            DOUBLE_,
            LONG_,
            TEXT_,
            TEXT2_,
            STATE_
          ) values (
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
          ) [23505-199]
      	at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:146)
      	at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:129)
      	at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:122)
      	at org.apache.ibatis.executor.CachingExecutor.flushStatements(CachingExecutor.java:114)
      	at org.apache.ibatis.session.defaults.DefaultSqlSession.flushStatements(DefaultSqlSession.java:253)
      	... 18 common frames omitted
      Caused by: org.h2.jdbc.JdbcBatchUpdateException: Eindeutiger Index oder Primärschlüssel verletzt: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"
      Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_4E ON PUBLIC.ACT_HI_VARINST(ID_) VALUES 1"; SQL statement:
      insert into ACT_HI_VARINST (
            ID_,
            PROC_DEF_KEY_,
            PROC_DEF_ID_,
            ROOT_PROC_INST_ID_,
            PROC_INST_ID_,
            EXECUTION_ID_,
            ACT_INST_ID_,
            TENANT_ID_,
            CASE_DEF_KEY_,
            CASE_DEF_ID_,
            CASE_INST_ID_,
            CASE_EXECUTION_ID_,
            TASK_ID_,
            NAME_,
            REV_,
            VAR_TYPE_,
            CREATE_TIME_,
            REMOVAL_TIME_,
            BYTEARRAY_ID_,
            DOUBLE_,
            LONG_,
            TEXT_,
            TEXT2_,
            STATE_
          ) values (
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
          ) [23505-199]
      	at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1298)
      	at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:122)
      	... 22 common frames omitted
      

      Hints:

      • Before migrating the process instance the existing variable foo is stored in ACT_RU_VARIABLE but not in ACT_HI_VARINST
      • After migrating the process instance the existing variable foo is stored in ACT_RU_VARIABLE and also in ACT_HI_VARINST
      • When executing the job, the engine tries to insert the same historic variable (with the same ID) into ACT_HI_VARINST

        This is the controller panel for Smart Panels app

              thorben.lindhauer Thorben Lindhauer
              roman.smirnov Roman Smirnov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: