hibernate 使用C3P0死锁Creating emergency threads for unassigned pending tasks

J2EE 码拜 10年前 (2015-04-03) 2525次浏览 0个评论

错误信息:
WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner – com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@7d6e44ca — APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner – com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@7d6e44ca — APPARENT DEADLOCK!!! Complete Status: 
Managed Threads: 3
Active Threads: 3
Active Tasks: 
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@62c057ba (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@41bfa6fc (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@d6c0c1d (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
Pending Tasks: 
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@308f4acd
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@f77f1a3
Pool thread stack traces:
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,RMI Runtime]
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:152)

 
hibernate 使用C3P0死锁Creating emergency threads for unassigned pending tasks
jdbc配置:
hibernate.hbm2ddl.auto=update
hibernate.show_sql=true

c3p0.initial.pool.size=10
c3p0.min.pool.size=5
c3p0.max.pool.size=40
c3p0.maxIdleTime = 60
c3p0.acquireIncrement = 5
c3p0.maxStatements = 0
c3p0.checkoutTimeout =100

c3p0.acquireRetryAttempts = 30
c3p0.idleConnectionTestPeriod = 60
#c3p0.acquireRetryDelay = 1000
#c3p0.automaticTestTable = t_c3p0

hibernate 使用C3P0死锁Creating emergency threads for unassigned pending tasks
datasource:

 <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
        <property name="driverClass" value="${connection.driver.class}"/>
        <property name="jdbcUrl" value="${connection.url}"/>
        <property name="user" value="${connection.username}"/>
        <property name="password" value="${connection.password}"/>
        <!--连接池中保留的最大连接数。-->
        <property name="maxPoolSize" value="${c3p0.max.pool.size}"/>
        <!--连接池中保留的最小连接数。-->
        <property name="minPoolSize" value="${c3p0.min.pool.size}"/>
        <!--初始化时获取的连接数,取值应在minPoolSize与maxPoolSize之间。-->
        <property name="initialPoolSize" value="${c3p0.initial.pool.size}"/>
        <!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
        <property name="maxIdleTime" value="${c3p0.maxIdleTime}"/>
        <!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。 -->
        <property name="acquireIncrement" value="${c3p0.acquireIncrement}"/>
        <!--定义在从数据库获取新连接失败后重复尝试的次数。-->
        <property name="acquireRetryAttempts" value="${c3p0.acquireRetryAttempts}"/>
        <!--每60秒检查所有连接池中的空闲连接。Default: 0 -->
        <property name="idleConnectionTestPeriod" value="${c3p0.idleConnectionTestPeriod}"/>
        <property name="maxStatements" value="${c3p0.maxStatements}"/>
        <!--连接池用完时客户调用getConnection()后等待获取连接的时间,单位:毫秒。超时后会抛出-->
        <!--SQLEXCEPTION,如果设置0,则无限等待。Default:0-->
 		<property name="checkoutTimeout" value="${c3p0.checkoutTimeout}"/>
        <!--获取连接失败将会引起所有等待连接池来获取连接的线程抛出异常。但是数据源仍有效
      保留,并在下次调用getConnection()的时候继续尝试获取连接。如果设为true,那么在尝试
      获取连接失败后该数据源将申明已断开并永久关闭。Default: false-->
        <property name="breakAfterAcquireFailure" value="false"/>
        <!--因性能消耗大请只在需要的时候使用它。如果设为true那么在每个connection提交的
     时候都将校验其有效性。建议使用idleConnectionTestPeriod或automaticTestTable
     等方法来提升连接测试的性能。Default: false -->
        <property name="testConnectionOnCheckout" value="false"/>
    </bean>
hibernate 使用C3P0死锁Creating emergency threads for unassigned pending tasks
hibernate 使用C3P0:
 

<property name="hibernateProperties">
			<props>
                <!--使用c3p0-->
                <prop key="connection.provider_class">org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider</prop>
				<prop key="hibernate.dialect">${hibernate.dialect}</prop>
				<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
				<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
				<prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate4.SpringSessionContext</prop>

                <prop key="hibernate.cache.use_second_level_cache">true</prop>
                <prop key="hibernate.cache.use_query_cache">false</prop>
                <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
                <!--<prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</prop>-->

            </props>
hibernate 使用C3P0死锁Creating emergency threads for unassigned pending tasks
看看磁盘空间和数据库日志是不是过大
hibernate 使用C3P0死锁Creating emergency threads for unassigned pending tasks
Quote: 引用 4 楼 sinat_25328187 的回复:

看看磁盘空间和数据库日志是不是过大[/quoe]
没有,我怀疑应该是C3P0连接配置的问题

hibernate 使用C3P0死锁Creating emergency threads for unassigned pending tasks
100分
这是一个C3P0的bug,签定完毕。

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明hibernate 使用C3P0死锁Creating emergency threads for unassigned pending tasks
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!