[jboss-user] [JBoss jBPM] - Connections never close. Two many connections exception

ffernandez do-not-reply at jboss.com
Tue Mar 18 13:01:52 EDT 2008


I have a problem because the connections to database (mysql) are never closed, so the configurated limit is reached.

When a processInstances is created, it's also created the connection to database, but this connection is never closed. The processInstance is ENDED, but the connection to database is still open (sleep in mysql). So, when I have 100 processInstances created, my database limit is reached.

This is the code for processInstance :

  | JbpmContext jbpmContext = this.configuration.createJbpmContext();
  | try {
  |     processInstance = jbpmContext.newProcessInstanceForUpdate( "xx" );	
  |     processInstance.signal();
  | } finally {
  |     jbpmContext.close();
  | }
  | 

In the jbpmContext.close(); the connection it's not closed, so remains always open.

Here my Hibernate configuration:

  |  <!-- JDBC connection properties (begin) -->
  |     <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  |     <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/xxx</property>
  |     <property name="hibernate.connection.username">foo</property>
  |     <property name="hibernate.connection.password">bar</property>
  |     <property name="hibernate.connection.isolation">2</property>
  | 
  |   <!-- 
  |     <property name="hibernate.c3p0.acquire_increment">1</property> 
  | 	<property name="hibernate.c3p0.idle_test_period">0</property>  
  | 	<property name="hibernate.c3p0.max_size">10</property> 
  | 	<property name="hibernate.c3p0.max_statements">0</property> 
  | 	<property name="hibernate.c3p0.min_size">5</property> 
  | 	<property name="hibernate.c3p0.timeout">60</property>
  |      -->
  | 

I also have tested the c3p0 but it's the same, the connections are never reused and so the pool limit is reached. 

In the DbPersistenceService.closeConnection method I see that the only way to close connection is when mustConnectionBeClosed = true. And mustConnectionBeClosed is true only when DataSource is defined  if (persistenceServiceFactory.getDataSource()!=null) { mustConnectionBeClosed = true } . 

Any suggestion? Thanks in advanced



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4137517#4137517

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4137517



More information about the jboss-user mailing list