commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <dirk.verbe...@pandora.be>
Subject Re: [DBCP] Connection leak in PoolableConnection.close()
Date Tue, 15 Feb 2005 17:57:49 GMT
Hi Hugh,

You have a good point there. Your suggestion is using _closed is 
correct but we also need to invalidate the pooled connection if the 
underlying connection is closed.
I have put some code into this bugzilla issue:
http://issues.apache.org/bugzilla/show_bug.cgi?id=33591

Can you verify this is ok for you?

Cheers
Dirk


Hugh Winkler wrote:

> Hi DBCP,
> 
> PoolableConnection.close() does logic equivalent to :
> 
>   if ( isClosed()){
>       throw new SQLException(.);
>   } else {
>       _pool.returnObject(this);
>   }
> 
> The isClosed() method is that of ancestor DelegatingConnection, and it does:
>   if(_closed || _conn.isClosed()) {
>       return true;
>   }
>   return false;
> 
> 
> Now nothing prevents the underlying connection from closing itself; that's
> why isClosed() checks _conn.isClosed() -- "did you close yourself while I
> wasn't looking?" But in that case PoolableConnection never calls
> _pool.returnObject(). 
> 
> I've got a query in Oracle 10g that causes Oracle's connection to close
> itself: the famous "end of file on connection" message causes the connection
> to enter the closed state. Doesn't take long to exhaust the pool.
> 
> I think the logic we want in PoolableConnection.close() is like so:
> 
> 
> 
>   if ( _closed ){ // really ask, did *we* close the connection already
>       throw new SQLException(.);
>   } else {
>       _pool.returnObject(this);
>   }
> 
> If I've got some logic wrong please stop me before I deploy that change
> here!
> 
> Regards,
> 
> Hugh



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


Mime
View raw message