Tracking DB statements in BoneCP - fixing DB statements leak

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • 3.7.1, 3.8.0
    • Affects Version/s: 3.7.0
    • Component/s: None
    • None

      Fisheye and Crucible is using BoneCP 0.7.1.RELEASE as a data base connection pool. In this version when the connection is returned to the pool statements are not closed. According to JDBC API statements should be closed when a connection is closed (= returned to the pool).

      9.4.4 Closing Connection Objects
      An application calls the method Connection.close to indicate that it has finished
      using a connection. All Statement objects created from a given Connection object
      will be closed when the close method for the object is called.

      It is expected from a database pool manager to perform this cleaning: https://github.com/brettwooldridge/HikariCP/wiki/Pool-Analysis

      It seems this bug is a specially affecting the application performance when used with MySQL. The MySQL driver connection object (com.mysql.jdbc.JDBC4Connection) contains a reference to all open statements. This can eventually cause an OOM.

      As a workaround for MySQL is to add

      dontTrackOpenResources=true
      

      parameter to the MySQL connection URL:

      jdbc:mysql://[host][:port]/[database]?dontTrackOpenResources=true
      

      Issue was observed on MySQL and Oracle but most likely affects other DBs too.

            Assignee:
            Maciej Swinarski (Inactive)
            Reporter:
            Maciej Swinarski (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: