AnsweredAssumed Answered

Deadlock in DbIdGenerator

Question asked by exp2345 on Sep 5, 2014
Latest reply on Sep 10, 2014 by exp2345
This is a follow up to http://forums.activiti.org/comment/25407. I have posted in the Activiti Engine forum because I have reproduced the issue without explorer. See the linked thread for a simple process the reproduces the problem.

When there are a large number of jobs queued in the system occasionally two or more threads get stuck waiting indefinitely. The issue occurs more frequently when the process engine is shut down and restarted while jobs are queued. The issue occurs when a single instance of a process engine is running (not clustered).

The Spring config used for the engine is pasted below, and the thread dump is attached.


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
   xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jee="http://www.springframework.org/schema/jee"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
       http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd">


    <bean id="jerseyClientFactory" class="com.CLIENT.bw2.util.JerseyClientFactory"/>
    <bean id="jerseyClient" class="com.sun.jersey.api.client.Client" factory-bean="jerseyClientFactory" factory-method="create"/>

     <context:component-scan base-package="com.CLIENT.bw2.service"  />

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location" value="${CLIENT.yml.config}" />
        <property name="propertiesPersister" ref="myYamlPersister" />
        <!– Allow other PropertyPlaceholderConfigurer to run as well –>
        <property name="ignoreUnresolvablePlaceholders" value="true"/>
    </bean>
    <bean id="myYamlPersister" class="com.CLIENT.spring.YamlPropertiesPersister"></bean>

  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="${database.driverClass}" />
    <property name="url" value="${database.url}" />
    <property name="username" value="${database.user}" />
    <property name="password" value="${database.password}" />
    <property name="defaultAutoCommit" value="false" />
  </bean>

  <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
     <property name="dataSource" ref="dataSource" />
  </bean>
 
  <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
    <property name="history" value="audit" />
     <property name="dataSource" ref="dataSource" />
     <property name="transactionManager" ref="transactionManager" />
     <property name="databaseSchemaUpdate" value="true" />
    <property name="jobExecutor" ref="jobExecutor"/>
     <property name="jobExecutorActivate" value="true" />
    <!– TODO: had to comment out this line, not sure why –>
    <!–<property name="enableDatabaseEventLogging" value="true" />–>
      <!–<property name="deploymentResources" value="classpath*:/diagrams/*.bpmn" />–>
    <property name="customFormTypes">
      <list>
        <bean class="org.activiti.explorer.form.UserFormType"/>
        <bean class="org.activiti.explorer.form.ProcessDefinitionFormType"/>
        <bean class="org.activiti.explorer.form.MonthFormType"/>  
      </list>
    </property>
      <property name="eventListeners">
          <list>
              <bean class="com.CLIENT.bw2.util.LoggingActivitiEventListener" />
          </list>
      </property>
  </bean>
 
  <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean" destroy-method="destroy">
     <property name="processEngineConfiguration" ref="processEngineConfiguration" />
  </bean>
 
  <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
  <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
  <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
  <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
  <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
  <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />
  <bean id="formService" factory-bean="processEngine" factory-method="getFormService" />
 
  <!–<bean id="activitiLoginHandler" class="org.activiti.explorer.ui.login.DefaultLoginHandler">–>
    <!–<property name="identityService" ref="identityService" />–>
  <!–</bean>–>

    <bean id="jobExecutor" class="org.activiti.engine.impl.jobexecutor.DefaultJobExecutor"/>

</beans>

Attachments

Outcomes