个人新开博客,欢迎大家来访问,O(∩_∩)O谢谢。
数据库连接池配置:
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="${env.jdbc.driverClassName}"/>
<property name="jdbcUrl" value="${env.jdbc.url}"/>
<property name="user" value="${env.jdbc.username}"/>
<property name="password" value="${env.jdbc.password}"/>
<property name="acquireIncrement" value="3"/>
<property name="initialPoolSize" value="3"/>
<property name="minPoolSize" value="2"/>
<property name="maxPoolSize" value="50"/>
<property name="maxIdleTime" value="600"/>
<property name="idleConnectionTestPeriod" value="900"/>
<property name="maxStatements" value="100"/>
<property name="numHelperThreads" value="10"/>
</bean>
异常信息:
2012-04-17 20:41:08,290 [Timer-0] WARN async.ThreadPoolAsynchronousRunner - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@15335332 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
2012-04-17 21:08:05,952 [Timer-0] WARN async.ThreadPoolAsynchronousRunner - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@15335332 -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 10
Active Threads: 1
Active Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask@71d1be4e (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#9)
Pending Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask@1252d43
Pool thread stack traces:
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#9,5,main]
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:560)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main]
java.lang.Object.wait(Native Method)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:534)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main]
java.lang.Object.wait(Native Method)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:534)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#6,5,main]
java.lang.Object.wait(Native Method)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:534)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#5,5,main]
java.lang.Object.wait(Native Method)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:534)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#3,5,main]
java.lang.Object.wait(Native Method)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:534)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#8,5,main]
java.lang.Object.wait(Native Method)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:534)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main]
java.lang.Object.wait(Native Method)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:534)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#4,5,main]
java.lang.Object.wait(Native Method)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:534)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#7,5,main]
java.lang.Object.wait(Native Method)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:534)
2012-04-18 09:12:40,381 [Timer-0] WARN async.ThreadPoolAsynchronousRunner - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@15335332 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
解决方案:
在网上搜索了很长时间也没有结果,有说改 maxStatements 配置,也有改连接池大小的配置,但是都没有效果
问题重现也很难复现,源码分析也似乎其中的一个线程获取数据后,处理很长时间,然后其他线程都处于挂起状态,没有先存起来,以后继续分析,如果有谁解决了这个请给出方案,谢谢