原来的DB设置下能够正常启动,有一次遇到下面的错误感觉好奇怪。

17:57:45,805 WARN  Timer-0 [ThreadPoolAsynchronousRunner:608] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@640ce0bb -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
17:57:45,809 WARN  Timer-0 [ThreadPoolAsynchronousRunner:624] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@640ce0bb -- APPARENT DEADLOCK!!! Complete Status:
    Managed Threads: 3
    Active Threads: 3
    Active Tasks:
        com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@68487fb7 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
        com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6fb8fcdd (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
        com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@59e14a78 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
    Pending Tasks:
        com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@55e03a61
        com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7418e252


在网上查了半天,发现如下解决办法。

The warning message you saw does not necessarily mean deadlock. It may cause by a too small connect pool size or too few helper thread.

What configuration do you have for c3p0?

Please try to increase the pool size and helper thread number, then try again.
jdbc.default.maxPoolSize=100
jdbc.default.minPoolSize=10
jdbc.default.numHelperThreads=10

增加maxPoolSize就可以了。以前为什么是好的还是没有搞清楚。


其实这个错误最常见还是ext配置的文件的编码出现问题。也就是读取不了正常的数据库配置信息的时候,会出现这种异常。

还有一种可能就是超过数据库的最大连接数,比如程序的代码里面没有关闭连接等。

GitHub 加速计划 / th / ThreadPool
3
0
下载
A simple C++11 Thread Pool implementation
最近提交(Master分支:3 个月前 )
9a42ec13 - 10 年前
fcc91415 - 10 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐