Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: 1.4
    • Fix Version/s: 1.3.1
    • Environment:

      MySQL Connector/J 5.1.12; JOTM 2.1.9; propesed solution is tested with Derby 10.5.3.0_1 as well

      Description

      After creation of connection in DataSourceXAConnectionFactory::createConnection() the instance of XAConnection is ready to be garbage collected. But in MySQL Connector/J this instance holds the real physiscal connection to MySQL server. Thus, simple test case (in attach) opens 2 connections to server and the first one can be considered as "leak".

      The possible solution is to close "parent" XA connection as soon as "child" Connection is closed as well. Due to compatibility issues it may be an option for BasicManagerDataSource. However, Derby seems okay with both variants (according to my test cases with JOTM/Hibernate/Derby/DBCP(+-patch))

      In the attachment - "manual" test case, since i don't know how to count real MySQL connection number in runtime. When BasicManagedDataSource is used (change it at ~43) we can create breakpoint at line "connection.close();" (~115). According to MySQL Administrator there are 2 connections, but according to pool - only one. If BasicManagedDataSourceXAClose is used - first connection correclty closed.

      This issue created serious problems in out production system, but, due to existing workaround (replace BasicManagedDataSource and DataSourceXAConnectionFactory) priority is minor.

      1. MySQL and DBCP.zip
        12 kB
        Sergey Vladimirov

        Issue Links

          Activity

          Hide
          Clement Pang added a comment -

          Not sure what's the workaround stated in the description is (other than to not use DBCP). Basically, one cannot use XA mySQL connections with DBCP if this bug is not fixed (since connections will never be closed properly).

          Show
          Clement Pang added a comment - Not sure what's the workaround stated in the description is (other than to not use DBCP). Basically, one cannot use XA mySQL connections with DBCP if this bug is not fixed (since connections will never be closed properly).
          Hide
          Florent Guillaume added a comment -

          I've attached a patch in DBCP-355.

          Show
          Florent Guillaume added a comment - I've attached a patch in DBCP-355 .

            People

            • Assignee:
              Unassigned
              Reporter:
              Sergey Vladimirov
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 8h
                8h
                Remaining:
                Remaining Estimate - 8h
                8h
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Development