Ibatis insert error in table ACT_HI_VARINST (possibly related to history level)

Good morning,

I get the following error when I launch 120 simultaneous process instances of my process:

Caused by: org.apache.ibatis.exceptions.PersistenceException:

Error updating database. Cause: java.sql.SQLException: Transaction cannot proceed STATUS_MARKED_ROLLBACK

SQL: insert into ACT_HI_VARINST (ID_, PROC_INST_ID_, EXECUTION_ID_, ACT_INST_ID_, CASE_INST_ID_, CASE_EXECUTION_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )

Cause: java.sql.SQLException: Transaction cannot proceed STATUS_MARKED_ROLLBACK

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26) [mybatis-3.2.8.jar:3.2.8]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:154) [mybatis-3.2.8.jar:3.2.8]
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:141) [mybatis-3.2.8.jar:3.2.8]
at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.executeInsertEntity(DbSqlSession.java:136) [camunda-engine-7.2.0.jar:7.2.0]
at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.insertEntity(DbSqlSession.java:126) [camunda-engine-7.2.0.jar:7.2.0]
at org.camunda.bpm.engine.impl.db.AbstractPersistenceSession.executeDbOperation(AbstractPersistenceSession.java:35) [camunda-engine-7.2.0.jar:7.2.0]
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:265) [camunda-engine-7.2.0.jar:7.2.0]
at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:258) [camunda-engine-7.2.0.jar:7.2.0]
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:187) [camunda-engine-7.2.0.jar:7.2.0]
... 182 more

Caused by: java.sql.SQLException: Transaction cannot proceed STATUS_MARKED_ROLLBACK
at org.jboss.jca.adapters.jdbc.WrapperDataSource.checkTransactionActive(WrapperDataSource.java:262)
at org.jboss.jca.adapters.jdbc.WrappedConnection.checkTransactionActive(WrappedConnection.java:1604)
at org.jboss.jca.adapters.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:1619)
at org.jboss.jca.adapters.jdbc.WrappedConnection.checkTransaction(WrappedConnection.java:1593)
at org.jboss.jca.adapters.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:398)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:75) [mybatis-3.2.8.jar:3.2.8]
at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:85) [mybatis-3.2.8.jar:3.2.8]
at org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler.java:57) [mybatis-3.2.8.jar:3.2.8]
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:73) [mybatis-3.2.8.jar:3.2.8]
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:47) [mybatis-3.2.8.jar:3.2.8]
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:105) [mybatis-3.2.8.jar:3.2.8]
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:71) [mybatis-3.2.8.jar:3.2.8]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:152) [mybatis-3.2.8.jar:3.2.8]
… 189 more

I’m using camunda 7.2.0 on JBoss EAP 6.4, my standalone for the camunda subsystem is as follows:

    <subsystem xmlns="urn:org.camunda.bpm.jboss:1.1">
        <process-engines>
            <process-engine name="default" default="true">
                <datasource>
                    java:jboss/datasources/EpsilonJtaDS
                </datasource>
                <history-level>
                    audit
                </history-level>
                <configuration>
                    org.camunda.bpm.container.impl.jboss.config.ManagedJtaProcessEngineConfiguration
                </configuration>
                <properties>
                    <property name="jobExecutorAcquisitionName">
                        default
                    </property>
                    <property name="isAutoSchemaUpdate">
                        true
                    </property>
                    <property name="authorizationEnabled">
                        true
                    </property>
                    <property name="jobExecutorDeploymentAware">
                        true
                    </property>
                    <property name="executionTreePrefetchEnabled">
                        false
                    </property>
                </properties>
                <plugins>
                    <plugin>
                        <class>
                            org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin
                        </class>
                    </plugin>
                </plugins>
            </process-engine>
        </process-engines>
        <job-executor>
            <thread-pool-name>
                job-executor-tp
            </thread-pool-name>
            <job-acquisitions>
                <job-acquisition name="default">
                    <acquisition-strategy>
                        SEQUENTIAL
                    </acquisition-strategy>
                    <properties>
                        <property name="lockTimeInMillis">
                            300000
                        </property>
                        <property name="waitTimeInMillis">
                            5000
                        </property>
                        <property name="maxJobsPerAcquisition">
                            10
                        </property>
                    </properties>
                </job-acquisition>
            </job-acquisitions>
        </job-executor>
    </subsystem>

The error seems to raise less times with history level “audit” than with “full”. Anyway, is this a bug? How could I get rid of it? Maybe upgrading to an specific version of camunda engine?

Thanks in advance.

Hi Alfonso,

7.2.0 is quite old version, could you please try to reproduce the issue with more recent version - 7.8.0 or 7.9.0-alpha4.
The thing is that many bug fixes are lying between these versions.

Best regards,
Yana