You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by "jpettens@rochester.rr.com" <jp...@rochester.rr.com> on 2003/06/13 19:10:31 UTC

Torque ConnectionPool issue - Oracle 9.2.0 not closing resources

Hi,

I'm using Torque 3.0.1 with Oracle 9.2.0 and JRE 1.4.01 on both Windows 
2000 and Solaris 2.8 environments.  Torque has been configured to use 
the old style connection pooling, not the jdbc2pool.

What I have been observing in the UNIX env is that oracle is NOT 
cleaning up its thin client connections and they just grow.  This 
observation is validated by "ps -ef | grep LOCAL which shows open 
processes attached to the oracle account and DB instance.  

I have pinned down the problem to the close logic in popConnection() in 
ConnectionPool.

If a connection is expired, the logic does a close and decrements the 
total count and then does a getNewConnection(). All well and fine; I 
think this worked OK with Oracle 8.1.7 and the classes12.jar jdbc impl. 
This does not work well with Oracle 9.2.0 and the ojdbc14.jar.

While the connection.close() is called, it looks like (speculation on my 
part) that oracle does not really close the connection if the connection 
object is not eligible for garbage collection.

Artificial Test case:  

torque.dsfactory.ORCL.factory=org.apache.torque.dsfactory.TorqueDataSour
ceFactory torque.dsfactory.ORCL.pool.defaultMaxConnections=5 
torque.dsfactory.ORCL.pool.maxExpiryTime=5 
torque.dsfactory.ORCL.pool.connectionWaitTimeout=20

Repeat calls to DB every 6 seconds.  popConnection() detects expired 
pcon and gets a new one.

Oracle processes grow for each DB conn call, even though expiry detected 
and close is called.

When I looked at the popConnection() logic, the close is custom and not 
a call to closePooledConnection().  The difference is that 
closePooledConnection() removed the timsestamp map reference for the 
pcon.  Not removing it, made pcon bypass GC and the timestamp map grew 
forever...

I changed the popConnection() code to use closePooledConnection() and 
re-ran my test case, this time the oracle connections do go above the 
defaultMaxConnections value, but do get cleaned up periodically.

I have included the modified ConnectionPool.java.
If anyone has questions about this issue, please contact me.

P.S.  Should I be using the jdbc2pool pooling, not the native pooling?

Jeff Pettenski

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .