[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2032) consider updating c3p0 because of connection leak bug

Nicklas Nordborg (JIRA) noreply at atlassian.com
Tue Nov 28 09:57:04 EST 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2032?page=comments#action_25449 ] 

Nicklas Nordborg commented on HHH-2032:
---------------------------------------

I don't know if this is related, but there is a problem with SchemaUpdate in Hibernate 3.2.1 that didn't exist in 3.2.0cr3. They have the same version of c3p0, but maybe the usage has changed to make the bug appear.

What happens is that the SchemaUpdate opens two new connections for each table but doesn't seem to close them. I have tested with MySQL and Postgres which both have a 'max connections' setting of 100. So, when the SchemaUpdate gets to table 49 or 50 it writes out error messages:

14:43:58,253  WARN BasicResourcePool:1222 - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask at edf4c8 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30).

There are three workarounds to the problem:

1. Revert back to Hibernate 3.2.0.cr3 (not really an option)
2. Increase the 'max connections' setting for the database
3. Disable c3p0 by removing it from hibernate.cfg.xml

None, 

I can post a debug.level output if somebody want's it. In any case here is the last few lines of it before the failure:

14:45:40,640  INFO ConnectionProviderFactory:72 - Initializing connection provider: org.hibernate.connection.C3P0ConnectionProvider
14:45:40,640  INFO C3P0ConnectionProvider:50 - C3P0 using driver: org.postgresql.Driver at URL: jdbc:postgresql:base2
14:45:40,640  INFO C3P0ConnectionProvider:51 - Connection properties: {user=base2user, password=****, release_mode=after_transaction}
14:45:40,641  INFO C3P0ConnectionProvider:54 - autocommit mode: false
14:45:40,723  INFO SettingsFactory:81 - RDBMS: PostgreSQL, version: 8.0.4
14:45:40,723  INFO SettingsFactory:82 - JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.1 JDBC3 with SSL (build 407)
14:45:40,724  INFO Dialect:151 - Using dialect: org.hibernate.dialect.PostgreSQLDialect
14:45:40,725  INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
14:45:40,725  INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
14:45:40,726  INFO SettingsFactory:134 - Automatic flush during beforeCompletion(): disabled
14:45:40,726  INFO SettingsFactory:138 - Automatic session close at end of transaction: disabled
14:45:40,726  INFO SettingsFactory:153 - Scrollable result sets: enabled
14:45:40,726 DEBUG SettingsFactory:157 - Wrap result sets: disabled
14:45:40,727  INFO SettingsFactory:161 - JDBC3 getGeneratedKeys(): disabled
14:45:40,727  INFO SettingsFactory:169 - Connection release mode: after_transaction
14:45:40,727  INFO SettingsFactory:196 - Default batch fetch size: 1
14:45:40,727  INFO SettingsFactory:200 - Generate SQL with comments: disabled
14:45:40,728  INFO SettingsFactory:204 - Order SQL updates by primary key: disabled
14:45:40,728  INFO SettingsFactory:369 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
14:45:40,728  INFO ASTQueryTranslatorFactory:24 - Using ASTQueryTranslatorFactory
14:45:40,728  INFO SettingsFactory:212 - Query language substitutions: {}
14:45:40,729  INFO SettingsFactory:217 - JPA-QL strict compliance: disabled
14:45:40,729  INFO SettingsFactory:222 - Second-level cache: enabled
14:45:40,729  INFO SettingsFactory:226 - Query cache: enabled
14:45:40,729  INFO SettingsFactory:356 - Cache provider: org.hibernate.cache.EhCacheProvider
14:45:40,731  INFO SettingsFactory:241 - Optimize cache for minimal puts: disabled
14:45:40,731  INFO SettingsFactory:250 - Structured second-level cache entries: disabled
14:45:40,731  INFO SettingsFactory:343 - Query cache factory: org.hibernate.cache.StandardQueryCacheFactory
14:45:40,731 DEBUG SQLExceptionConverterFactory:52 - Using dialect defined converter
14:45:40,732  INFO SettingsFactory:277 - Statistics: disabled
14:45:40,732  INFO SettingsFactory:281 - Deleted entity synthetic identifier rollback: disabled
14:45:40,732  INFO SettingsFactory:296 - Default entity-mode: pojo
14:45:40,770  INFO TableMetadata:39 - table found: public.Groups
14:45:40,770  INFO TableMetadata:40 - columns: [removed, system_id, description, name, id, quota_id, version]
14:45:40,770  INFO TableMetadata:42 - foreign keys: [fk7fa2c5f49d6885da]
14:45:40,771  INFO TableMetadata:43 - indexes: [groups_pkey]
14:45:40,771  INFO ConnectionProviderFactory:72 - Initializing connection provider: org.hibernate.connection.C3P0ConnectionProvider
14:45:40,771  INFO C3P0ConnectionProvider:50 - C3P0 using driver: org.postgresql.Driver at URL: jdbc:postgresql:base2
14:45:40,772  INFO C3P0ConnectionProvider:51 - Connection properties: {user=base2user, password=****, release_mode=after_transaction}
14:45:40,772  INFO C3P0ConnectionProvider:54 - autocommit mode: false
..............................14:46:10,545  WARN BasicResourcePool:1222 - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask at 1d0e2c9 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30).
14:46:10,779  WARN BasicResourcePool:1222 - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask at 1d0e17a -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30).
14:46:10,779  WARN BasicResourcePool:1222 - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask at d8fd1a -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30).
.14:46:10,839  WARN SettingsFactory:109 - Could not obtain connection metadata
java.sql.SQLException: Connections could not be acquired from the underlying database!
	at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:104)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:236)
	at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java:94)
	at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35)
	at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2002)
	at org.hibernate.cfg.Configuration.generateSchemaUpdateScript(Configuration.java:947)
	at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:140)
	at net.sf.basedb.core.HibernateUtil.createStaticTables(HibernateUtil.java:444)
	at net.sf.basedb.core.Install.createTables(Install.java:127)
	at net.sf.basedb.install.InitDB.main(InitDB.java:64)
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
	at com.mchange.v2.resourcepool.BasicResourcePool.awaitAcquire(BasicResourcePool.java:970)
	at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:208)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:232)
	... 9 more



> consider updating c3p0 because of connection leak bug
> -----------------------------------------------------
>
>          Key: HHH-2032
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2032
>      Project: Hibernate3
>         Type: Task

>   Components: core
>     Versions: 3.2.0.cr4
>     Reporter: Max Rydahl Andersen
>     Assignee: Max Rydahl Andersen
>     Priority: Critical
>      Fix For: 3.2.2
>  Attachments: C3P0ConnectionProvider.java
>
>
> c3p0-0.9.0.4 apparently has a connection leak (case  00010976) that is fixed in c3p0-0.9.1-pre6.
> will though have to look into if it is a drop-in replacement because of the following excerpt from the relaes notes:
> Deprecated PoolConfig, and began implementation of new C3P0Config approach to configuration.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list