[jboss-dev-forums] [Design of JCA on JBoss] - [JBAS-5095] Race condition between connection.close() and tr
jesper.pedersen
do-not-reply at jboss.com
Thu Jul 24 07:30:55 EDT 2008
I have been looking at subject for both 5.0.CR2 and 4.2.4.GA.
As Adrian states there is a race condition between connection.close() and an asynchronous transaction completion (e.g. transaction timeout) that can lead to a leaked connection permit with eventual pool exhaustion when using track-connection-by-tx (i.e. all local resources).
The fix (has he states) is to check that the number of handles are zero and the connection no longer is track-by-tx in an atomic way.
I have introduced a reentrant lock that is used when isManagedConnectionFree() is used in combination with returnManagedConnection(). The lock is defined as an instance variable in TxConnectionManager - and the code is guarded using the lock() / unlock() methods.
The overhead of the reentraant lock is minimal when operating with track-by-tx == false and the lock only comes into play in afterCompletion() when track-by-tx is true.
The patch have been attached to the JIRA issue for review.
Any feedback is welcomed !
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4166381#4166381
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4166381
More information about the jboss-dev-forums
mailing list