c3p0 连接过多导致tomcat无法启动的解决方法
c3p0 连接过多导致tomcat无法启动的解决方法
施长成 发表于3年前
c3p0 连接过多导致tomcat无法启动的解决方法
  • 发表于 3年前
  • 阅读 27
  • 收藏 0
  • 点赞 0
  • 评论 0

【腾讯云】如何购买服务器最划算?>>>   

摘要: c3p0 连接过多导致tomcat无法启动的解决方法

错误:

WARN  com.mchange.v2.async.ThreadPoolAsynchronousRunner  com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@27e467f7 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
2015-04-30 10:29:43 WARN  com.mchange.v2.async.ThreadPoolAsynchronousRunner  com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@27e467f7 -- APPARENT DEADLOCK!!! Complete Status:
        Managed Threads: 3
        Active Threads: 3
        Active Tasks:
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6bd962a4 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@cdb344d (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@b46b1d3 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
        Pending Tasks:
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4e44996d
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@79b4eb3f
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@54c0b385
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@374a0c3b
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@5e6911d8
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4412ac54
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@25efe1b6
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@27cb872f
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@23183312
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@9c0f4be
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@5b03eaf2
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@5e35e48c
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@242fd3a6
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@3ff049d9
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@3880665a
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@75bfbbb0
                com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7ebb5c34
Pool thread stack traces:
        Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main]
                java.net.PlainSocketImpl.socketConnect(Native Method)
                java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
                java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
                java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
                java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
                java.net.Socket.connect(Socket.java:579)
                java.net.Socket.connect(Socket.java:528)
                java.net.Socket.<init>(Socket.java:425)
                java.net.Socket.<init>(Socket.java:241)
                com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
                com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:293)
                com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2181)
                com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
                com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
                sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                java.lang.reflect.Constructor.newInstance(Constructor.java:526)
                com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
                com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:357)
                com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
                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-#0,5,main]
                java.net.PlainSocketImpl.socketConnect(Native Method)
                java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
                java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
                java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
                java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
                java.net.Socket.connect(Socket.java:579)
                java.net.Socket.connect(Socket.java:528)
                java.net.Socket.<init>(Socket.java:425)
                java.net.Socket.<init>(Socket.java:241)
                com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
                com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:293)
                com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2181)
                com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
                com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
                sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                java.lang.reflect.Constructor.newInstance(Constructor.java:526)
                com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
                com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:357)
                com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
                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.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
                java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
                java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
                java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
                java.net.Socket.connect(Socket.java:579)
                java.net.Socket.connect(Socket.java:528)
                java.net.Socket.<init>(Socket.java:425)
                java.net.Socket.<init>(Socket.java:241)
                com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
                com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:293)
                com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2181)
                com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
                com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
                sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                java.lang.reflect.Constructor.newInstance(Constructor.java:526)
                com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
                com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:357)
                com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
                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)

解决方法:

    先关闭mysql数据库,然后在打开数据库,只限于测试环境,如果是正式环境请设置连接池的最大数量小于mysql的最大连接数量,而且不用mysql工具连接服务器,或者连接后及时关闭,减少连接数。

标签: c3p0 连接数过多
共有 人打赏支持
粉丝 4
博文 63
码字总数 22544
×
施长成
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: