You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/04/20 12:01:58 UTC

DO NOT REPLY [Bug 34539] New: - Deadlock when evicting dbcp objects (testWhileIdle=true)

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34539>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34539

           Summary: Deadlock when evicting dbcp objects (testWhileIdle=true)
           Product: Commons
           Version: 1.2 Final
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: major
          Priority: P2
         Component: Pool
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: phnixwxz1@yahoo.com


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.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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