我正在使用休眠5.1.0和c3p0 0.9.5.1。我没有启用缓存,并且出现Apparent Deadlock
错误。
(C3P0PooledConnectionPoolManager[identityToken->2v2d5k9y3ipope1s0apgi|4b76251c]-AdminTaskTimer) com.mchange.v2.async.ThreadPoolAsynchronousRunner: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@2a94bd11 -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 3
Active Threads: 3
Active Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@2ece5321
on thread: C3P0PooledConnectionPoolManager[identityToken->2v2d5k9y3ipope1s0apgi|4b76251c]-HelperThread-#2
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@736e6fcf
on thread: C3P0PooledConnectionPoolManager[identityToken->2v2d5k9y3ipope1s0apgi|4b76251c]-HelperThread-#1
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@5ceffb3c
on thread: C3P0PooledConnectionPoolManager[identityToken->2v2d5k9y3ipope1s0apgi|4b76251c]-HelperThread-#0
Pending Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@75425131
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@29c943e3
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@29d94102
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@a4c691e
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@6d606abf
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@ed5eaab
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@6de76b22
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@40aeb19
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@6a514cb5
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@4b7073e6
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1d18afd1
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@4e19dd48
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@2ecd04da
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@666abda6
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@3ed4e09d
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@3ea78992
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@788aa148
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@4bbea472
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@52f76590
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@509e9d45
Pool thread stack traces:
Thread[C3P0PooledConnectionPoolManager[identityToken->2v2d5k9y3ipope1s0apgi|4b76251c]-HelperThread-#2,5,main]
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
java.net.Socket.connect(Socket.java:589)
java.net.Socket.connect(Socket.java:538)
java.net.Socket.<init>(Socket.java:434)
java.net.Socket.<init>(Socket.java:244)
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:243)
com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:297)
com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2232)
com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2265)
com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064)
com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790)
com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
sun.reflect.GeneratedConstructorAccessor74.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:423)
com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:395)
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
我的c3p0配置为:
hibernate.connection.provider_class = "org.hibernate.c3p0.internal.C3P0ConnectionProvider";
hibernate.c3p0.min_size = "200";
hibernate.c3p0.max_size = "200";
hibernate.c3p0.idle_test_period = "100";
hibernate.c3p0.max_statements = "0";
hibernate.c3p0.timeout = "86400";
hibernate.c3p0.preferredTestQuery = "select 1";
任何想法我为什么会陷入僵局。根据我在网上看到的缓存,是导致这种情况在未启用缓存的情况下发生的主要原因。
答案 0 :(得分:0)
您的应用程序从数据库获取连接的尝试都被挂起,无论是成功还是失败,都没有异常。这些冻结的连接获取尝试耗尽了线程池。您需要调试为什么挂起连接尝试的原因。如今,这通常是由于管理云托管基础架构的安全性/防火墙策略所致。