开发者社区> 问答> 正文

C3p0启动报异常APPARENT DEADLOCK!!!?报错

@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!!!

求教解决方法

展开
收起
爱吃鱼的程序员 2020-06-10 14:23:36 983 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    用druid。c3p0线程池性能没有druid好。感谢,我试试看用druid吧,稳定性、性能、功能都比c3p0好感谢,我试试看。还没用过这个我一直用的是druid,还真不知道c3p0会遇到这个问题。

    2020-06-10 14:23:51
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载