Hi,
we are experiencing a deadlock situation that seem to be closely related with c3p0 on our production tomcats.
I have examined the effect by producing a thread dump while the application refused to react to struts actions invloving data-base io.
the dump shows a lot of c3p0 Helper threads like this
Code:
"com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2" daemon prio=1 tid=0x94b638b8 nid=0x5454 in Object.wait() [92930000..9293087c]
at java.lang.Object.wait(Native Method)
- waiting on <0x9b1859c8> (a com.mchange.v2.async.ThreadPoolAsynchronousRunner)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:355)
- locked <0x9b1859c8> (a com.mchange.v2.async.ThreadPoolAsynchronousRunner)
alltogether there are more than 100 Threads
a couple of threads show a method stack where c3p0 ist asked for a connection but chooses to wait for a thread (0x9c06b928) that is not existent/is not shown in the dump !!
Code:
"Thread-48" daemon prio=1 tid=0x8dd07b88 nid=0x5454 in Object.wait() [8ca29000..8ca2a87c]
at java.lang.Object.wait(Native Method)
- waiting on <0x9c06b928> (a com.mchange.v2.resourcepool.BasicResourcePool)
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAcquire(BasicResourcePool.java:968)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:208)
- locked <0x9c06b928> (a com.mchange.v2.resourcepool.BasicResourcePool)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:260)
at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java:94)
at com.mchange.v2.c3p0.ComboPooledDataSource.getConnection(ComboPooledDataSource.java:521)
at de.ald.solvay.usecases.login.LoginAction.setSchwackeDate(LoginAction.java:298)
at de.ald.solvay.usecases.login.LoginAction.execute(LoginAction.java:256)
at org.apache.struts.action.RequestProcessor.processActionPerform
.......
I have c3p0-0.9.0.2.jar in the WEB-INF/lib directory
and use it partly through "my own" hibernate.cfg.xml
Code:
<property name="hibernate.c3p0.max_size">100</property>
<property name="hibernate.c3p0.min_size">25</property>
<property name="hibernate.c3p0.timeout">2000</property>
<property name="hibernate.c3p0.idle_test_period">1000</property>
<property name="hibernate.c3p0.max_statements">0</property>
<property name="hibernate.c3p0.acquire_increment">2</property>
I disabled the statement cache some time ago due to problems with oracle and therefore I can not rely on the solution proposed in
http://forum.hibernate.org/viewtopic.php?t=947246&start=0&postdays=0&postorder=asc&highlight=but the application is using c3p0 from several components' persistence layers, and I am now wondering if I missed setting the statement cache in another place
1. a c3p0 JNDI DataSource is used by
a third party component through ibatis.
Code:
<Resource name="jdbc/pooledDS" auth="Container" type="com.mchange.v2.c3p0.ComboPooledDataSource" />
<ResourceParams name="jdbc/pooledDS">
<parameter> <name>factory</name> <value>org.apache.naming.factory.BeanFactory</value> </parameter>
<parameter> <name>driverClass</name> <value>oracle.jdbc.driver.OracleDriver</value> </parameter>
<parameter> <name>jdbcUrl</name> <value>jdbc:oracle:oci:@kat_abna.ald.de</value> </parameter>
<parameter> <name>user</name> <value>cse_cpmcc</value> </parameter>
<parameter> <name>password</name> <value>cse</value> </parameter>
<parameter> <name>minPoolSize</name> <value>5</value> </parameter>
<parameter> <name>maxPoolSize</name> <value>15</value> </parameter>
<parameter> <name>acquireIncrement</name> <value>5</value> </parameter>
</ResourceParams>
how can I set the statement cache in this scenario ?
will the c3p0 Pool not automatically use the configuration
2. another subcomponent has its own hibernate.cfg.xml.
this is where c3p0 was initially contained in the componet libs. but when I examine the hibernate.cfg.xml I cannot find a hint that c3p0 is actually used.
My intention behind this (I have to admit) complicated architecture is to use only one connectionpool-technology for several distinct connection pool instances (all components have individual connection properties).
do you consider this a good idea?
do you have experience with such a setup ?