Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-193

BasicDataSource returns negative values for NumActive when Oracle Driver Connection#isClosed return true (End of file communication on CHannel)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.2.1, 1.2.2
    • 1.3
    • None
    • Windows / Oracle 10G JDBC driver / Oracle 10G / JDK 1.4.2_08 / Commons-dbcp-1.2.1.jar / COmmons-pool-1.3.jar

    Description

      Hello,
      This bug occurs if the following conditions are met:
      A End of File communication on CHannel occurs
      Oracle Driver 10G will return true for Connection#isClosed()

      Related bugs:
      DBCP-3
      DBCP-28

      Case 1:
      The client calls isClosed() before closing a connection since commons-dbcp does not allow double close without throwing (see DBCP-3)
      => The problem is that since he calls isClosed, he encounters the same bug reported in DBCP-28 because conn.isClosed() will return true and the client will not call close.
      if (!conn.isClosed())
      {
      try{
      conn.close();
      }catch(Exception e){}
      }
      see what happens if the isClosed() in PoolableConnection returns true : ShowsLeaksIfCheckForIsClosed.java

      Case2:
      The client tries to find a solution, and calls conn.close() without checking isClosed(), but the problem is that the client is in a Persistence fwk and the client may have already called close, so he ends up calling close() twice, see what happens if the isClosed() in PoolableConnection returns true : ShowsBasicDataSourceBadNumActiveIfNoCheckForIsClosedAndDoubleClose.java

      Attachments

        1. ShowsBasicDataSourceBadNumActiveIfNoCheckForIsClosedAndDoubleClose.java
          2 kB
          Philippe Mouawad
        2. ShowsLeaksIfCheckForIsClosed.java
          2 kB
          Philippe Mouawad
        3. TestUtils.java
          1 kB
          Philippe Mouawad

        Issue Links

          Activity

            People

              Unassigned Unassigned
              p.mouawad@ubik-ingenierie.com Philippe Mouawad
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: