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

orphaned connectionPools created on Exception within createDataSource method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.2.2, 1.3, 1.4
    • 1.3.1, 1.4.1
    • None
    • Linux
      MySQL 5.1.47
      JDK 1.6
      commonsPool 1.5.4

    Description

      When an Exception is thrown in the BasicDataSource.createDataSource after the connectionPool instance variable has been set the connectionPool is not closed.

      If the timeBetweenEvictionRunsMillis is greater than zero a TaskTimer evictor is created in the GenericObjectPool. This TaskTimer keeps running even though the DataSource was not successfully created. The evictor when it runs will attempt to create connections for this orphaned connectionPool up to the min connections (minIdle).

      If the database is down when the createDataSource is called an Exception will be thrown and an orphaned connectionPool will be created. If serveral retries are attempted while the database is down several orphaned connectionPools are created. Once the database is back up, all these orphaned connectionPool's evitor threads will attempt to created minIdle connections to the database. This exhausts the max num connections on the database.

      One solution to to close the connectionPool when an Exception is thrown within the createDataSource method.

      Attachments

        1. DBCP-339.patch
          0.3 kB
          Dmitry Semibratov

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mikeseawa Mike Bartlett
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: