[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6891) Hibernate is not reusing connections from the pool

Mat Banik (JIRA) noreply at atlassian.com
Tue Dec 13 19:38:19 EST 2011


Hibernate is not reusing connections from the pool
--------------------------------------------------

                 Key: HHH-6891
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6891
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 4.0.0.CR7
         Environment: Hibernate 4, MySQL 5.6
            Reporter: Mat Banik


I have tried two connection pool providers C3P0 and Commons DBCP. Both are the most current versions. 
Everything starts fine. And data is loading from database as expected.
But with C3P0 when left to defaults everything stops when maximum of 15 connections are reached. Nothing is freed up and the application behaves like it has memory leak.

Here is bottom of log output

2011-12-13/17:21:55.167/EST [http-bio-80-exec-2] DEBUG begin
2011-12-13/17:21:55.167/EST [http-bio-80-exec-2] DEBUG Obtaining JDBC connection
2011-12-13/17:21:55.167/EST [http-bio-80-exec-2] DEBUG acquire test -- pool is already maxed out. [managed: 15; max: 15]
2011-12-13/17:21:55.167/EST [http-bio-80-exec-2] DEBUG awaitAvailable(): com.mchange.v2.c3p0.impl.NewPooledConnection at 46f0decc
2011-12-13/17:21:55.167/EST [http-bio-80-exec-2] DEBUG trace com.mchange.v2.resourcepool.BasicResourcePool at 9671641 [managed: 15, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection at 46f0decc)

With Commons DBCP everything work as well until when maximum connections are reached and than it throws exception:

org.springframework.orm.hibernate4.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [n/a]; SQL state [null]; error code [0]; Could not open connection; nested exception is org.hibernate.exception.GenericJDBCException: Could not open connection org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:165) org.springframework.orm.hibernate4.HibernateExceptionTranslator.convertHibernateAccessException(HibernateExceptionTranslator.java:50) org.springframework.orm.hibernate4.HibernateExceptionTranslator.translateExceptionIfPossible(HibernateExceptionTranslator.java:37) org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:58) org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213) org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:163) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list