C3p0启动报异常APPARENT DEADLOCK!!!

mawenasuka 发布于 2016/02/14 11:23
阅读 1K+
收藏 1

@JFinal 你好,想跟你请教个问题:

项目在服务器上跑了一段时间以后出现错误,重启抑或是在本地调试都在启动时直接报错

WARNING: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@6fc07ed -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Feb 14, 2016 11:04:40 AM com.mchange.v2.async.ThreadPoolAsynchronousRunner
WARNING: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@6fc07ed -- APPARENT DEADLOCK!!! Complete Status:
 Managed Threads: 3
 Active Threads: 3
 Active Tasks:
  com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@4906f379
   on thread: C3P0PooledConnectionPoolManager[identityToken->6jtw2l9e1pitvyb1ixzt0p|2ce7fe0b]-HelperThread-#1
  com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@2f2346db
   on thread: C3P0PooledConnectionPoolManager[identityToken->6jtw2l9e1pitvyb1ixzt0p|2ce7fe0b]-HelperThread-#2
  com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@78855b94
   on thread: C3P0PooledConnectionPoolManager[identityToken->6jtw2l9e1pitvyb1ixzt0p|2ce7fe0b]-HelperThread-#0
 Pending Tasks:
  com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@574ab09d
  com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@29290c36
  com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1c098256
  com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@4e0223b8
  com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@4c4ebcbd
  com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@2d6751be
  com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@7d2c6d76
Pool thread stack traces:
 Thread[C3P0PooledConnectionPoolManager[identityToken->6jtw2l9e1pitvyb1ixzt0p|2ce7fe0b]-HelperThread-#1,5,main]
  java.net.DualStackPlainSocketImpl.waitForConnect(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)
  com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:454)
  com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1018)
  com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:817)
  com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:700)
  com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:842)
  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)
  com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
  com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
  com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)

我翻了一下以前的帖子,找到类似的问题,提及到的解决方法如下

((com.mchange.v2.c3p0.ComboPooledDataSource)DbKit.getDataSource()).setXxxx(...);

将maxStatement设为0

但是这个方法如果放在afterafterJFinalStart()方法下没有效果,因为是已启动就报错,应该不会执行这个方法

程序运行到这里就报错了

jfinalConfig.configPlugin(plugins);     startPlugins(); // very important!!!

求教解决方法

加载中
1
tinshen
tinshen
用druid。c3p0线程池性能没有druid好。
m
mawenasuka
感谢,我试试看
1
wenshao
wenshao
用druid吧,稳定性、性能、功能都比c3p0好
m
mawenasuka
感谢,我试试看。还没用过这个
0
会哭的鳄鱼
会哭的鳄鱼
我一直用的是druid,还真不知道c3p0会遇到这个问题。
返回顶部
顶部