C3P0使用出错!

7 篇文章 0 订阅

个人博客:http://demi-panda.com/
个人新开博客,欢迎大家来访问,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  配置,也有改连接池大小的配置,但是都没有效果


问题重现也很难复现,源码分析也似乎其中的一个线程获取数据后,处理很长时间,然后其他线程都处于挂起状态,没有先存起来,以后继续分析,如果有谁解决了这个请给出方案,谢谢



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值