Commons Dbcp
  1. Commons Dbcp
  2. DBCP-28

[dbcp][PATCH] Connection leak in PoolableConnection.close() (Oracle 10g driver)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.2.2
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: PC

      Description

      Mail from Hugh Winkler on commons-dev (15-2-2005)
      --------------------------------------------------
      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!

      1. TestUtils.java
        1 kB
        Philippe Mouawad
      2. ShowsLeaksIfCheckForIsClosed.java
        2 kB
        Philippe Mouawad
      3. ShowsBasicDataSourceBadNumActiveIfNoCheckForIsClosedAndDoubleClose.java
        2 kB
        Philippe Mouawad
      4. ASF.LICENSE.NOT.GRANTED--TestPoolableConnection.patch
        5 kB
        James Ring
      5. ASF.LICENSE.NOT.GRANTED--PoolableConnection.patch
        0.7 kB
        James Ring

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Dirk Verbeeck
          • Votes:
            5 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development