commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "craig mcmillan (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DBCP-281) [dbcp] Deadlock when evicting dbcp objects (testWhileIdle=true) [ re-open of DBCP-65]
Date Mon, 26 Jan 2009 14:03:59 GMT

     [ https://issues.apache.org/jira/browse/DBCP-281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

craig mcmillan updated DBCP-281:
--------------------------------

        Fix Version/s:     (was: 1.2.2)
          Description: 
re-open of DBCP-65... it ain't fixed yet

The GenericKeyedObjectPool$Evictor thread can still deadlock with dbcp
objects.



"Timer-1":
	at org.apache.commons.dbcp.AbandonedTrace.addTrace(AbandonedTrace.java:175)
	- waiting to lock <0x13cb66c0> (a org.apache.commons.dbcp.PoolableConnection)
	at org.apache.commons.dbcp.AbandonedTrace.init(AbandonedTrace.java:92)
	at org.apache.commons.dbcp.AbandonedTrace.<init>(AbandonedTrace.java:82)
	at org.apache.commons.dbcp.DelegatingStatement.<init>(DelegatingStatement.java:61)
	at org.apache.commons.dbcp.DelegatingConnection.createStatement(DelegatingConnection.java:224)
	at org.apache.commons.dbcp.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:331)
	at org.apache.commons.dbcp.PoolableConnectionFactory.validateObject(PoolableConnectionFactory.java:312)
	at org.apache.commons.pool.impl.GenericObjectPool.evict(GenericObjectPool.java:1217)
	- locked <0x0af4d498> (a org.apache.commons.pool.impl.GenericObjectPool)
	at org.apache.commons.pool.impl.GenericObjectPool$Evictor.run(GenericObjectPool.java:1341)
	at java.util.TimerThread.mainLoop(Timer.java:512)
	at java.util.TimerThread.run(Timer.java:462)
"extract_themes_from_message_command_container-2":
	at org.apache.commons.pool.impl.GenericObjectPool.addObjectToPool(GenericObjectPool.java:1136)
	- waiting to lock <0x0af4d498> (a org.apache.commons.pool.impl.GenericObjectPool)
	at org.apache.commons.pool.impl.GenericObjectPool.returnObject(GenericObjectPool.java:1076)
	at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:87)
	- locked <0x13cb66c0> (a org.apache.commons.dbcp.PoolableConnection)
	at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:181)
	at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.closeConnection(LocalDataSourceConnectionProvider.java:96)
	at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:451)
	at org.hibernate.jdbc.ConnectionManager.aggressiveRelease(ConnectionManager.java:406)
	at org.hibernate.jdbc.ConnectionManager.afterTransaction(ConnectionManager.java:293)
	at org.hibernate.jdbc.JDBCContext.afterTransactionCompletion(JDBCContext.java:221)
	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:119)
	at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:606)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:709)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:678)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
	at net.tramposys.log.context.hibernate.HibernateLogContextManager.createOrAssociateLogContextWithJmsMessage(HibernateLogContextManager.java:68)
	at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
	at $Proxy30.createOrAssociateLogContextWithJmsMessage(Unknown Source)
	at net.tramposys.commandq.jms.JmsCommandExecutor.onMessage(JmsCommandExecutor.java:59)
	at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:531)
	at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:466)
	at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:435)
	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:316)
	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:235)
	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:927)
	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:851)
	at java.lang.Thread.run(Thread.java:613)

  was:
The GenericKeyedObjectPool$Evictor thread has probability of deadlock with dbcp
objects.

For example, at a certain time, a normal user thread calls a PoolingConnection
object's synchronized method, which in turn calls GenericKeyedObjectPool
object's synchronzied method.

At the same time, the evictor thread calls the GenericKeyedObjectPool object's
synchronized method 'evict', which in turn calls the PoolingConnection object's
synchronized method.  When testWhileIdle=true, the probability of evictor
calling GenericKeyedObjectPool's synchronized method is much greater.

The following is the deadlock information in the thread dump of our program
(testWhileIdle=true):

"Thread-106":
	at org.apache.commons.dbcp.AbandonedTrace.removeTrace(AbandonedTrace.java:221)
	- waiting to lock <0x6a6b1b80> (a org.apache.commons.dbcp.PoolingConnection)
	at
org.apache.commons.dbcp.PoolablePreparedStatement.passivate(PoolablePreparedStatement.java:100)
	at
org.apache.commons.dbcp.PoolingConnection.passivateObject(PoolingConnection.java:239)
	at
org.apache.commons.pool.impl.GenericKeyedObjectPool.evict(GenericKeyedObjectPool.java:1001)
	- locked <0x6a6b1858> (a org.apache.commons.pool.impl.GenericKeyedObjectPool)
	at
org.apache.commons.pool.impl.GenericKeyedObjectPool$Evictor.run(GenericKeyedObjectPool.java:1156)
	at java.lang.Thread.run(Thread.java:534)
"Thread-41":
	at
org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:715)
	- waiting to lock <0x6a6b1858> (a
org.apache.commons.pool.impl.GenericKeyedObjectPool)
	at
org.apache.commons.dbcp.PoolingConnection.prepareStatement(PoolingConnection.java:87)
	- locked <0x6a6b1b80> (a org.apache.commons.dbcp.PoolingConnection)
	at
org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:185)
	at
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:278)
...

This problem can be worked around by setting testWhileIdle to false, although
there is still very small possibility of deadlock.

    Affects Version/s: 1.2.2
              Summary: [dbcp] Deadlock when evicting dbcp objects (testWhileIdle=true) [ re-open
of DBCP-65]  (was: CLONE -[dbcp] Deadlock when evicting dbcp objects (testWhileIdle=true))

> [dbcp] Deadlock when evicting dbcp objects (testWhileIdle=true) [ re-open of DBCP-65]
> -------------------------------------------------------------------------------------
>
>                 Key: DBCP-281
>                 URL: https://issues.apache.org/jira/browse/DBCP-281
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Operating System: All
> Platform: All
>            Reporter: craig mcmillan
>
> re-open of DBCP-65... it ain't fixed yet
> The GenericKeyedObjectPool$Evictor thread can still deadlock with dbcp
> objects.
> "Timer-1":
> 	at org.apache.commons.dbcp.AbandonedTrace.addTrace(AbandonedTrace.java:175)
> 	- waiting to lock <0x13cb66c0> (a org.apache.commons.dbcp.PoolableConnection)
> 	at org.apache.commons.dbcp.AbandonedTrace.init(AbandonedTrace.java:92)
> 	at org.apache.commons.dbcp.AbandonedTrace.<init>(AbandonedTrace.java:82)
> 	at org.apache.commons.dbcp.DelegatingStatement.<init>(DelegatingStatement.java:61)
> 	at org.apache.commons.dbcp.DelegatingConnection.createStatement(DelegatingConnection.java:224)
> 	at org.apache.commons.dbcp.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:331)
> 	at org.apache.commons.dbcp.PoolableConnectionFactory.validateObject(PoolableConnectionFactory.java:312)
> 	at org.apache.commons.pool.impl.GenericObjectPool.evict(GenericObjectPool.java:1217)
> 	- locked <0x0af4d498> (a org.apache.commons.pool.impl.GenericObjectPool)
> 	at org.apache.commons.pool.impl.GenericObjectPool$Evictor.run(GenericObjectPool.java:1341)
> 	at java.util.TimerThread.mainLoop(Timer.java:512)
> 	at java.util.TimerThread.run(Timer.java:462)
> "extract_themes_from_message_command_container-2":
> 	at org.apache.commons.pool.impl.GenericObjectPool.addObjectToPool(GenericObjectPool.java:1136)
> 	- waiting to lock <0x0af4d498> (a org.apache.commons.pool.impl.GenericObjectPool)
> 	at org.apache.commons.pool.impl.GenericObjectPool.returnObject(GenericObjectPool.java:1076)
> 	at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:87)
> 	- locked <0x13cb66c0> (a org.apache.commons.dbcp.PoolableConnection)
> 	at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:181)
> 	at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.closeConnection(LocalDataSourceConnectionProvider.java:96)
> 	at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:451)
> 	at org.hibernate.jdbc.ConnectionManager.aggressiveRelease(ConnectionManager.java:406)
> 	at org.hibernate.jdbc.ConnectionManager.afterTransaction(ConnectionManager.java:293)
> 	at org.hibernate.jdbc.JDBCContext.afterTransactionCompletion(JDBCContext.java:221)
> 	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:119)
> 	at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:606)
> 	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:709)
> 	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:678)
> 	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
> 	at net.tramposys.log.context.hibernate.HibernateLogContextManager.createOrAssociateLogContextWithJmsMessage(HibernateLogContextManager.java:68)
> 	at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
> 	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
> 	at $Proxy30.createOrAssociateLogContextWithJmsMessage(Unknown Source)
> 	at net.tramposys.commandq.jms.JmsCommandExecutor.onMessage(JmsCommandExecutor.java:59)
> 	at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:531)
> 	at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:466)
> 	at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:435)
> 	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:316)
> 	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:235)
> 	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:927)
> 	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:851)
> 	at java.lang.Thread.run(Thread.java:613)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message