使用C3P0-0.9.1.jar包的问题:APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!

from: http://blog.csdn.net/dingherry/article/details/6534494

C3P0-0.9.1.jar包的问题出现了:

view plain
2011-06-09 16:15:57.500 [com.mchange.v2.c3p0.C3P0Registry]-[INFO] Initializing c3p0-0.9.1 [built 16-January-2007 14:46:42; debug? true; trace: 10]
2011-06-09 16:15:57.640 [com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource]-[INFO] Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@6e6ed172 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@68581fed [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1bqc2na8gw1f1seoboglg|9bb04a, idleConnectionTestPeriod -> 0, initialPoolSize -> 20, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 5000, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 50, maxStatements -> 100, maxStatementsPerConnection -> 0, minPoolSize -> 20, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@96b27bd3 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 1bqc2na8gw1f1seoboglg|15a6bd5, jdbcUrl -> jdbc:oracle:thin:@172.7.19.70:1521:orcl, properties -> {user=******, password=******, autocommit=false, release_mode=auto} ], preferredTestQuery -> null, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> 1bqc2na8gw1f1seoboglg|730333, numHelperThreads -> 3 ]
2011-06-09 16:16:17.640 [com.mchange.v2.async.ThreadPoolAsynchronousRunner]-[WARN] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@689af4 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
2011-06-09 16:16:17.640 [com.mchange.v2.async.ThreadPoolAsynchronousRunner]-[WARN] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@689af4 -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 3
Active Threads: 3
Active Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@13c6c41 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1e74f39 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1023cad (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
Pending Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1dd8a94
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1b51005
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@2ec051
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@15422a8
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@af4653
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1321f9b
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1b8ffe1
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@a738be
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7e7592
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@58d3e2
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1be9a9b
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@985ae9
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7890f2
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@17418ba
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@10379d4
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1336fab
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1e85079
Pool thread stack traces:
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main]
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
java.net.Socket.connect(Socket.java:525)
java.net.Socket.connect(Socket.java:475)
java.net.Socket.<init>(Socket.java:372)
java.net.Socket.<init>(Socket.java:186)
oracle.net.nt.TcpNTAdapter.connect(Unknown Source)
oracle.net.nt.ConnOption.connect(Unknown Source)
oracle.net.nt.ConnStrategy.execute(Unknown Source)
oracle.net.resolver.AddrResolution.resolveAndExecute(Unknown Source)
oracle.net.ns.NSProtocol.establishConnection(Unknown Source)
oracle.net.ns.NSProtocol.connect(Unknown Source)
oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:843)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:267)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:413)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main]
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
java.net.Socket.connect(Socket.java:525)
java.net.Socket.connect(Socket.java:475)
java.net.Socket.<init>(Socket.java:372)
java.net.Socket.<init>(Socket.java:186)
oracle.net.nt.TcpNTAdapter.connect(Unknown Source)
oracle.net.nt.ConnOption.connect(Unknown Source)
oracle.net.nt.ConnStrategy.execute(Unknown Source)
oracle.net.resolver.AddrResolution.resolveAndExecute(Unknown Source)
oracle.net.ns.NSProtocol.establishConnection(Unknown Source)
oracle.net.ns.NSProtocol.connect(Unknown Source)
oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:843)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:267)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:413)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main]
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
java.net.Socket.connect(Socket.java:525)
java.net.Socket.connect(Socket.java:475)
java.net.Socket.<init>(Socket.java:372)
java.net.Socket.<init>(Socket.java:186)
oracle.net.nt.TcpNTAdapter.connect(Unknown Source)
oracle.net.nt.ConnOption.connect(Unknown Source)
oracle.net.nt.ConnStrategy.execute(Unknown Source)
oracle.net.resolver.AddrResolution.resolveAndExecute(Unknown Source)
oracle.net.ns.NSProtocol.establishConnection(Unknown Source)
oracle.net.ns.NSProtocol.connect(Unknown Source)
oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:843)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:267)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:413)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)



参考比较全的算:http://japi.iteye.com/blog/243702

http://www.dotobe.com/2010/10/tomcat-c3p0连接池问题,apparent-deadlock/
http://muzso.hu/2011/05/06/hibernate-c3p0-and-robust-database-connection-handling
http://agodika.com/mblog/tech/2011/02/16/fixing-c3p0-apparent-deadlock-problem/

SSH项目,设置hibernate.properties里的hibernate.c3p0.max_statements为0,重启tomcat好了。


这个C3P0的bug,存在着,并且一直存在着,其作者现在貌似无能为力,希望有人能突破这一瓶颈。

你可能感兴趣的:(thread,tomcat,c3p0,jdbc,properties,null)