tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Hanik - Dev Lists <devli...@hanik.com>
Subject Re: dbcp pool evictor deadlock?
Date Mon, 22 Jun 2009 21:17:04 GMT
Could be a bug in DBCP, sure looks like it.
You can try a drop in replacement that we are working on.

http://people.apache.org/~fhanik/jdbc-pool/v1.0.5/

Filip

Eric B. wrote:
> Hi,
>
> I appologize in advance for the cross-post, but I'm really not sure if this 
> is a problem with the dbcp code or my configuration.
>
> I ran into the most troublesome deadlock over the weekend on my server, and 
> cannot figure out how/or why this deadlock occured.  Via jconsole, I was 
> able to get thread information of the deadlock, but that hasn't helped me 
> diagnose the problem any further and/or determine if it is a config error, 
> or something more critical in the tomcat pool.
>
> >From what I can tell, there is a race condition where the evictor was 
> triggered at the exact same moment as a resource was being added back into 
> the pool.  The evictor was waiting for the resource to be added to the pool, 
> and the resource was waiting for the evictor to finish.  However, I'm not 
> sure if I am correct or not.
>
>
> My jndi settings are as follows:
>   <!-- Database resource -->
>    <Resource name="jdbc/db" auth="Container"
>                 type="javax.sql.DataSource" username="db" password="db"
>                 driverClassName="com.mysql.jdbc.Driver" 
> url="jdbc:mysql://localhost:3306/myapp?autoReconnect=true"
>                 maxActive="100" maxIdle="4"
>                 validationQuery="select 1"
>                 testOnBorrow="true"
>                 testWhileIdle="true"
>                 timeBetweenEvictionRunsMillis="10000"
>                 minEvictableIdleTimeMillis="60000" />
>
>
> My thread trace is the following:
> THREAD 1:
> Name: Timer-1
> State: BLOCKED on org.apache.tomcat.dbcp.dbcp.PoolableConnection@1e667871 
> owned by: scheduling.QuartzInternal_Worker-0
> Total blocked: 1  Total waited: 15,342
>
> Stack trace:
> org.apache.tomcat.dbcp.dbcp.AbandonedTrace.addTrace(AbandonedTrace.java:175)
> org.apache.tomcat.dbcp.dbcp.AbandonedTrace.init(AbandonedTrace.java:92)
> org.apache.tomcat.dbcp.dbcp.AbandonedTrace.<init>(AbandonedTrace.java:82)
> org.apache.tomcat.dbcp.dbcp.DelegatingStatement.<init>(DelegatingStatement.java:61)
> org.apache.tomcat.dbcp.dbcp.DelegatingConnection.createStatement(DelegatingConnection.java:224)
> org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:331)
> org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.validateObject(PoolableConnectionFactory.java:312)
> org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.evict(GenericObjectPool.java:1217)
>    - locked org.apache.tomcat.dbcp.pool.impl.GenericObjectPool@741a266
> org.apache.tomcat.dbcp.pool.impl.GenericObjectPool$Evictor.run(GenericObjectPool.java:1341)
> java.util.TimerThread.mainLoop(Unknown Source)
> java.util.TimerThread.run(Unknown Source)
>
>
> THREAD 2:
> Name: scheduling.QuartzInternal_Worker-0
> State: BLOCKED on org.apache.tomcat.dbcp.pool.impl.GenericObjectPool@741a266 
> owned by: Timer-1
> Total blocked: 156,031  Total waited: 206,465
>
> Stack trace:
> org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.addObjectToPool(GenericObjectPool.java:1137)
> org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.returnObject(GenericObjectPool.java:1076)
> org.apache.tomcat.dbcp.dbcp.PoolableConnection.close(PoolableConnection.java:87)
>    - locked org.apache.tomcat.dbcp.dbcp.PoolableConnection@1e667871
> org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:181)
> org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.closeConnection(LocalDataSourceConnectionProvider.java:96)
> org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:451)
> org.hibernate.jdbc.ConnectionManager.cleanup(ConnectionManager.java:385)
> org.hibernate.jdbc.ConnectionManager.close(ConnectionManager.java:324)
> org.hibernate.impl.SessionImpl.close(SessionImpl.java:298)
> org.springframework.orm.hibernate3.SessionFactoryUtils.closeSession(SessionFactoryUtils.java:791)
> org.springframework.orm.hibernate3.SessionFactoryUtils.closeSessionOrRegisterDeferredClose(SessionFactoryUtils.java:777)
> org.springframework.orm.hibernate3.HibernateTransactionManager.doCleanupAfterCompletion(HibernateTransactionManager.java:733)
> org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:989)
> org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:782)
> org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)
> org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
> $Proxy8.execute(Unknown Source)
> sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> java.lang.reflect.Method.invoke(Unknown Source)
> org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:276)
> org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:260)
> org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
> org.quartz.core.JobRunShell.run(JobRunShell.java:203)
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
>
>
>
> Any help or insight into the problem and/or the correct dbcp settings would 
> be appreciated to ensure that this doesn't happen again.
>
> Thanks,
>
> Eric
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message