Hello
Hibernate version:
3.2.6 GA
Mapping documents:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@chmiel.somwhere.com:1521:mz?database</property>
<property name="hibernate.connection.username">***</property>
<property name="hibernate.connection.password">***</property>
<property name="hibernate.connection.autocommit">false</property>
<property name="hibernate.current_session_context_class">thread</property>
<!-- Oracle9Dialect is deprecated. See Oracle9Dialect.java Hibernate core source code. -->
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.use_sql_comments">true</property>
<property name="hibernate.jdbc.fetch_size">101</property>
<property name="hibernate.jdbc.batch_size">102</property>
<property name="hibernate.default_batch_fetch_size">103</property>
<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.idle_test_period">0</property>
<property name="hibernate.c3p0.min_size">0</property>
<property name="hibernate.c3p0.max_size">48</property>
<property name="hibernate.c3p0.max_statements">250</property>
<property name="hibernate.c3p0.timeout">0</property>
</session-factory>
</hibernate-configuration>
Name and version of the database you are using:Oracle 9
JDBC version:The latest Oracle JDBC Driver (11g Release 1 (11.1.0.6) drivers).
I choose JDBC driver for Java 6.
c3p0 version:The latest available on the Internet: c3p0-0.9.1.2.
I
overwrote c3p0 jar file attached to Hibernate Core library.
c3p0.properties config file:Code:
c3p0.acquireRetryAttempts=2
c3p0.acquireRetryDelay=2500
c3p0.numHelperThreads=10
Java version:The latest Sun Java 6 version (Windows 2003 platform, 32 bit).
I've got (well known) problem with c3p0 and "APPARENT DEADLOCK!!!" errors.
My application is a standalone app. It is multithreaded app procesing thousand of database transactions in every working thread. There are about 16 worker threads.
But after several database transactions I've got a "APPARENT DEADLOCK!!!" errors in my log4j logfile:
Code:
2008-05-26 17:14:01,134 [ 11] DEBUG (484) org.hibernate.jdbc.AbstractBatcher - about to open ResultSet (open ResultSets: 0, globally: 0)
2008-05-26 17:14:01,134 [ 11] DEBUG (484) org.hibernate.loader.Loader - processing result set
2008-05-26 17:14:01,134 [ 11] DEBUG (484) org.hibernate.loader.Loader - result set row: 0
2008-05-26 17:14:01,134 [ 11] DEBUG (484) org.hibernate.loader.Loader - result row:
2008-05-26 17:14:01,134 [ 11] DEBUG (484) org.hibernate.type.NullableType - returning '0' as column: col_0_0_
2008-05-26 17:14:01,134 [ 11] DEBUG (484) org.hibernate.loader.Loader - done processing result set (1 rows)
2008-05-26 17:14:01,134 [ 11] DEBUG (484) org.hibernate.jdbc.AbstractBatcher - about to close ResultSet (open ResultSets: 1, globally: 1)
2008-05-26 17:14:01,134 [ 11] DEBUG (484) org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 13)
2008-05-26 17:14:01,134 [ 11] DEBUG (484) org.hibernate.jdbc.AbstractBatcher - closing statement
2008-05-26 17:14:01,134 [ 11] DEBUG (484) com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 250; checked out: 28; num connections: 17; num keys: 234
2008-05-26 17:14:01,134 [ 11] DEBUG (484) org.hibernate.engine.StatefulPersistenceContext - initializing non-lazy collections
2008-05-26 17:14:01,134 [ 11] DEBUG (484) com.mchange.v2.c3p0.stmt.GooGooStatementCache - com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache ----> CACHE HIT
2008-05-26 17:14:01,134 [ 11] DEBUG (484) com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkoutStatement: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 250; checked out: 29; num connections: 17; num keys: 234
2008-05-26 17:14:01,150 [ 10] DEBUG (495) com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 250; checked out: 28; num connections: 17; num keys: 234
2008-05-26 17:14:01,150 [ 10] DEBUG (495) com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 250; checked out: 27; num connections: 17; num keys: 234
2008-05-26 17:14:01,150 [ 10] DEBUG (495) com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 250; checked out: 26; num connections: 17; num keys: 234
2008-05-26 17:14:01,150 [ 11] DEBUG (484) com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 250; checked out: 25; num connections: 17; num keys: 234
2008-05-26 17:14:01,150 [ 11] DEBUG (484) com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 250; checked out: 24; num connections: 17; num keys: 234
2008-05-26 17:14:01,150 [ 11] DEBUG (484) com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 250; checked out: 23; num connections: 17; num keys: 234
2008-05-26 17:14:11,822 [Timer-0] WARN () com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@1bda414 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
2008-05-26 17:14:11,838 [Timer-0] WARN () com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@1bda414 -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 10
Active Threads: 10
Active Tasks:
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@1565730 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#5)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@1763f29 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#6)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@2c9d7e (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#8)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@117f9dc (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@114de27 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#9)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@104eeb1 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#7)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@d2c4bc (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@17233e3 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#4)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@aca3ce (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@362bc7 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#3)
Pending Tasks:
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@744830
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@2f719a
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@cb5e96
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@1aef86b
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@3768da
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@1c4c573
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@17f1fac
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@f89071
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@d2fa99
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@1427c43
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@1ec394e
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@1a66e6b
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@19b34ac
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@9f1a77
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@1828c62
Pool thread stack traces:
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#5,5,main]
oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1445)
oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:75)
oracle.jdbc.driver.OraclePreparedStatementWrapper.close(OraclePreparedStatementWrapper.java:77)
com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#6,5,main]
oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1445)
oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:75)
oracle.jdbc.driver.OraclePreparedStatementWrapper.close(OraclePreparedStatementWrapper.java:77)
com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#8,5,main]
oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1445)
oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:75)
oracle.jdbc.driver.OraclePreparedStatementWrapper.close(OraclePreparedStatementWrapper.java:77)
com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#9,5,main]
oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1445)
oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:75)
oracle.jdbc.driver.OraclePreparedStatementWrapper.close(OraclePreparedStatementWrapper.java:77)
com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main]
oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1445)
oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:75)
oracle.jdbc.driver.OraclePreparedStatementWrapper.close(OraclePreparedStatementWrapper.java:77)
com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#7,5,main]
oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1445)
oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:75)
oracle.jdbc.driver.OraclePreparedStatementWrapper.close(OraclePreparedStatementWrapper.java:77)
com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#4,5,main]
oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1445)
oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:75)
oracle.jdbc.driver.OraclePreparedStatementWrapper.close(OraclePreparedStatementWrapper.java:77)
com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main]
oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1445)
oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:75)
oracle.jdbc.driver.OraclePreparedStatementWrapper.close(OraclePreparedStatementWrapper.java:77)
com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main]
oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1445)
oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:75)
oracle.jdbc.driver.OraclePreparedStatementWrapper.close(OraclePreparedStatementWrapper.java:77)
com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#3,5,main]
oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1445)
oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:75)
oracle.jdbc.driver.OraclePreparedStatementWrapper.close(OraclePreparedStatementWrapper.java:77)
com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
2008-05-26 17:14:11,838 [Timer-0] DEBUG () com.mchange.v2.async.ThreadPoolAsynchronousRunner - Apparently some threads have been replaced. Replacement thread processing enabled.
2008-05-26 17:14:11,900 [ 12] DEBUG (503) com.mchange.v2.c3p0.stmt.GooGooStatementCache$Deathmarch - CULLING: { call TAROPTSTUBPKG.process_takeover_stub(?,?,?,?,?)}
2008-05-26 17:14:11,900 [ 12] DEBUG (503) com.mchange.v2.c3p0.stmt.GooGooStatementCache - cxnStmtMgr.statementSet( oracle.jdbc.driver.T4CConnection@1da02d7 ).size(): 15
2008-05-26 17:14:11,900 [ 12] DEBUG (503) com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkoutStatement: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 250; checked out: 24; num connections: 17; num keys: 234
I am struggling with it since last week I would be appreciated if somebody has an idea what is the reason of those deadlock.
I can provide other pieces of my logfile.
Kind regards,
Adaslaw