c3p0 -- APPARENT DEADLOCK!!问题
Posted 華廣一條魚
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c3p0 -- APPARENT DEADLOCK!!问题相关的知识,希望对你有一定的参考价值。
因为在项目配置c3p0数据库连接池,在启动Tomcat服务器时就报了以下错误(一开始懵逼了好一会儿),并且服务器弹框报连接超时,时间怎么延长都没用。
后来,在网上查了下,好像是c3p0这个jar包本身就有些问题,据说连作者都无能为力。我的解决方式是,检查下数据库可否连接,数据库不能连接,会导致这个服务器不能正常启动。确保数据库启动且可连接后,便正常了。
十月 26, 2017 10:25:40 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/8.0.32
十月 26, 2017 10:25:41 下午 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [552] milliseconds.
十月 26, 2017 10:25:43 下午 org.apache.jasper.servlet.TldScanner scanJars
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2017-10-26 22:25:43[INFO]-[Thread: localhost-startStop-1]-[com.mchange.v2.log.MLog.<clinit>()]: MLog clients using log4j logging.
2017-10-26 22:25:43[INFO]-[Thread: localhost-startStop-1]-[com.mchange.v2.c3p0.C3P0Registry.banner()]: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
十月 26, 2017 10:25:43 下午 net.sf.ehcache.config.ConfigurationFactory parseConfiguration
警告: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/G:/eclipse-java/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/notes/WEB-INF/lib/ehcache-1.6.2.jar!/ehcache-failsafe.xml
2017-10-26 22:25:43[INFO]-[Thread: localhost-startStop-1]-[com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getPoolManager()]: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 2, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hgfb429ropqnrs1q4z4de|5e04dc19, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> net.sf.log4jdbc.DriverSpy, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hgfb429ropqnrs1q4z4de|5e04dc19, idleConnectionTestPeriod -> 0, initialPoolSize -> 10, jdbcUrl -> jdbc:log4jdbc:mysql://localhost:3306/notes?useUnicode=true&characterEncoding=utf-8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 20, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 100, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 10, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> user=******, password=******, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
2017-10-26 22:26:03[WARN]-[Thread: Timer-0]-[com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector.run()]: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@5aea3b79 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
2017-10-26 22:26:03[WARN]-[Thread: Timer-0]-[com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector.run()]: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@5aea3b79 -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 3
Active Threads: 3
Active Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@542dde54 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@50125009 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1510d46f (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
Pending Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1eaa1447
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@244fa6b8
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@661f3820
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@753f2b20
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@3bf911ec
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@625a0a4d
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7d1bf01e
Pool thread stack traces:
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main]
java.net.DualStackPlainSocketImpl.connect0(Native Method)
java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
java.net.AbstractPlainSocketImpl.connect(Unknown Source)
java.net.PlainSocketImpl.connect(Unknown Source)
java.net.SocksSocketImpl.connect(Unknown Source)
java.net.Socket.connect(Unknown Source)
java.net.Socket.connect(Unknown Source)
java.net.Socket.<init>(Unknown Source)
java.net.Socket.<init>(Unknown Source)
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:257)
com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:298)
com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2391)
com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2428)
com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2213)
com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:797)
com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389)
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
net.sf.log4jdbc.DriverSpy.connect(DriverSpy.java:728)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
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.DualStackPlainSocketImpl.connect0(Native Method)
java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
java.net.AbstractPlainSocketImpl.connect(Unknown Source)
java.net.PlainSocketImpl.connect(Unknown Source)
java.net.SocksSocketImpl.connect(Unknown Source)
java.net.Socket.connect(Unknown Source)
java.net.Socket.connect(Unknown Source)
java.net.Socket.<init>(Unknown Source)
java.net.Socket.<init>(Unknown Source)
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:257)
com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:298)
com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2391)
com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2428)
com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2213)
com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:797)
com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389)
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
net.sf.log4jdbc.DriverSpy.connect(DriverSpy.java:728)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
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.DualStackPlainSocketImpl.connect0(Native Method)
java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
java.net.AbstractPlainSocketImpl.connect(Unknown Source)
java.net.PlainSocketImpl.connect(Unknown Source)
java.net.SocksSocketImpl.connect(Unknown Source)
java.net.Socket.connect(Unknown Source)
java.net.Socket.connect(Unknown Source)
java.net.Socket.<init>(Unknown Source)
java.net.Socket.<init>(Unknown Source)
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:257)
com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:298)
com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2391)
com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2428)
com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2213)
com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:797)
com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389)
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
net.sf.log4jdbc.DriverSpy.connect(DriverSpy.java:728)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
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)
以上是关于c3p0 -- APPARENT DEADLOCK!!问题的主要内容,如果未能解决你的问题,请参考以下文章
C3P0连接池启动时 APPARENT DEADLOCK!!! 错误
软件包工头之临时DBA系列Oracle连接非常慢APPARENT DEADLOCK
com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@1035079 -- APPARENT DEADLOCK!!! C