cancel
Showing results for 
Search instead for 
Did you mean: 

lock time out

brachi
Champ in-the-making
Champ in-the-making
i got this exception when running in multi threads.
any ideas?

15:00:58,992 ERROR [AcquireJobsRunnable] exception during job acquisition:
### Error querying database.  Cause: org.h2.jdbc.JdbcSQLException: Timeout trying to lock table "ACT_RU_EXECUTION"; SQL statement:
select
        RES.*
    from ACT_RU_JOB RES
        LEFT OUTER JOIN ACT_RU_EXECUTION PI ON PI.ID_ = RES.PROCESS_INSTANCE_ID_
    where (RES.RETRIES_ > 0)
      and (RES.DUEDATE_ is null or RES.DUEDATE_ < ?)
      and (RES.LOCK_OWNER_ is null or RES.LOCK_EXP_TIME_ < ?)
          and (
                    (RES.EXECUTION_ID_ is null)
                        or
                        (PI.SUSPENSION_STATE_ = 1)
      )
    LIMIT ? OFFSET ? [50200-171]
### The error may exist in org/activiti/db/mapping/entity/Job.xml
### The error may involve org.activiti.engine.impl.persistence.entity.JobEntity.selectNextJobsToExecute-Inline
### The error occurred while setting parameters
### SQL: select       RES.*            from ACT_RU_JOB RES          LEFT OUTER JOIN ACT_RU_EXECUTION PI ON PI.ID_ = RES.PROCESS_INSTANCE_ID_     where (RES.RETRIES_ > 0)       and (RES.DUEDATE_ is null or RES.DUEDATE_ < ?)       and (RES.LOCK_OWNER_ is null or RES.LOCK_EXP_TIME_ < ?)    and (         (RES.EXECUTION_ID_ is null)      or       (PI.SUSPENSION_STATE_ = 1)       )       LIMIT ? OFFSET ?
### Cause: org.h2.jdbc.JdbcSQLException: Timeout trying to lock table "ACT_RU_EXECUTION"; SQL statement:
select
        RES.*
    from ACT_RU_JOB RES
        LEFT OUTER JOIN ACT_RU_EXECUTION PI ON PI.ID_ = RES.PROCESS_INSTANCE_ID_
    where (RES.RETRIES_ > 0)
      and (RES.DUEDATE_ is null or RES.DUEDATE_ < ?)
      and (RES.LOCK_OWNER_ is null or RES.LOCK_EXP_TIME_ < ?)
          and (
                    (RES.EXECUTION_ID_ is null)
                        or
                        (PI.SUSPENSION_STATE_ = 1)
      )
    LIMIT ? OFFSET ? [50200-171]
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: org.h2.jdbc.JdbcSQLException: Timeout trying to lock table "ACT_RU_EXECUTION"; SQL statement:
3 REPLIES 3

vasile_dirla
Star Contributor
Star Contributor
Hi,
could you provide some more details ?
Activiti version, and other configurations…

Also if you have a jUnit which could show this would be nice.

brachi
Champ in-the-making
Champ in-the-making
activity:
         <groupId>org.activiti</groupId>
            <artifactId>activiti-engine</artifactId>
            <version>5.13</version>

<dependency>
            <groupId>org.activiti</groupId>
            <artifactId>activiti-spring</artifactId>
            <version>5.13</version>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.3.171</version>
        </dependency>

I don't have a simple unit test to attach, it works fine, until i have heavy load with many threads.
my activity configuration:

<bean id="activitiDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
        <property name="driverClass" value="org.h2.Driver"/>
        <property name="url"
                  value="jdbc:h2:mem:active;DB_CLOSE_DELAY=-1"/>
        <property name="username" value="sa"/>
        <property name="password" value=""/>
    </bean>

  <bean id="activitiTransactionManager"
          class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="activitiDataSource"/>
    </bean>

  <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration" depends-on="externalParsersLoader">
        <property name="createDiagramOnDeploy" value="false" />
        <property name="dataSource" ref="activitiDataSource"/>
        <property name="transactionManager" ref="activitiTransactionManager"/>
        <property name="databaseSchemaUpdate" value="true"/>
        <property name="jobExecutorActivate" value="true"/>
        <property name="history" value="none"/>
        <property name="preBpmnParseHandlers">
            <list>
               ….
            </list>
        </properties>


i don't need the parameters after the execution instance finish, any idea how to free it?

jbarrez
Star Contributor
Star Contributor
- 5.13 is a very old version of activiti
- Do you have multiple engines going against the same H2 database? If so, H2 is not strong when it comes to concurrency. Use a 'real' database instead (mysql, postgres, etc.)