commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 33591] - [dbcp] Connection leak in PoolableConnection.close() (Oracle 10g driver)
Date Tue, 14 Jun 2005 13:56:12 GMT
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=33591>.
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=33591





------- Additional Comments From h_u_w_lewis@hotmail.com  2005-06-14 15:56 -------

I also had some issues with this bug, has this bug solution been accepted yet?

When will the new fix be included in a new release of dbcp?

I recently fixed the problem myself with the code shown below for
PoolableConection.close() (i didn't notice Dirk Verbeeck had already posted a
solution),
I just invalidate any connection found to be already closed.
The JUnit tests all still pass with my fix, BUT if someone can see something
wrong with it please let me know.  I've been using it for a while now and it
seems to have fixed the connection leak problem i was experiencing.


public synchronized void close() throws SQLException {
        boolean isClosed = false;
        try {
            isClosed = isClosed();
        } catch (SQLException e) {
            try {
                _pool.invalidateObject(this);
            } catch (Exception ie) {
                // DO NOTHING the original exception will be rethrown
            }
            throw new SQLNestedException("Cannot close connection (isClosed
check failed)", e);
        }
        if (isClosed) {
            try {
                _pool.invalidateObject(this);
            } catch (Exception ie) {
                // DO NOTHING, "Already closed" exception thrown below
            }
            throw new SQLException("Already closed.");
        } else {
            try {
                _pool.returnObject(this);
            } catch(SQLException e) {
                throw e;
            } catch(RuntimeException e) {
                throw e;
            } catch(Exception e) {
                throw new SQLNestedException("Cannot close connection (return to
pool failed)", e);
            }
        }
    }


-- 
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


Mime
View raw message