glassfish
  1. glassfish
  2. GLASSFISH-17159

Validation failure after getting connection from DataSource causes connection leak

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 3.1.2_b13, 4.0
    • Component/s: jdbc
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      The ManagedConnectionFactory#createManagedConnection method of jdbc-ra calls the validateAndSetIsolation method after acquiring connections from DataSource.
      The validateAndSetIsolation method is a role of connection validation and initializing transaction isolation level. If any errors occur in the validateAndSetIsolation method, it will be returned to connector runtime without closing the acquired connection. This indicates the possibility of connection leak.

      Attached patch is to resolve this leak issue by calling the ManagedConnection#destroy method to close a physical connection. If connection close also fail after applying this patch, the following message will be printed in server.log.

      [#|$

      {Time}

      |WARNING|glassfish3.2|javax.enterprise.resource.resourceadapter.com.sun.gjc.spi|$

      {ThreadID}

      ;$

      {ThreadName}

      ;|RAR5083 : Exception while destroying physical connection
      java.sql.SQLException: $

      {A message in SQLException}

      at com.sun.gjc.spi.ManagedConnection.destroy(ManagedConnection.java:405)
      at com.sun.gjc.spi.CPManagedConnectionFactory.createManagedConnection(CPManagedConnectionFactory.java:161)
      at com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:87)
      ...

        Activity

        Hide
        Shalini added a comment -

        There could be a potential connection leak if the creation of new physical connection to the underlying EIS resource manager fails for some reason. This needs to be fixed. Fix is available for this issue.

        Show
        Shalini added a comment - There could be a potential connection leak if the creation of new physical connection to the underlying EIS resource manager fails for some reason. This needs to be fixed. Fix is available for this issue.
        Hide
        Shalini added a comment -

        Fixed in trunk.

        Sending appserver/jdbc/admin/src/main/java/org/glassfish/jdbc/admin/cli/JDBCConnectionPoolManager.java
        Sending appserver/jdbc/jdbc-ra/jdbc-core/src/main/java/com/sun/gjc/common/LocalStrings.properties
        Sending appserver/jdbc/jdbc-ra/jdbc-core/src/main/java/com/sun/gjc/spi/DMManagedConnectionFactory.java
        Sending appserver/jdbc/jdbc-ra/jdbc-core/src/main/java/com/sun/gjc/spi/ManagedConnectionFactory.java
        Transmitting file data ....
        Committed revision 51289.

        Show
        Shalini added a comment - Fixed in trunk. Sending appserver/jdbc/admin/src/main/java/org/glassfish/jdbc/admin/cli/JDBCConnectionPoolManager.java Sending appserver/jdbc/jdbc-ra/jdbc-core/src/main/java/com/sun/gjc/common/LocalStrings.properties Sending appserver/jdbc/jdbc-ra/jdbc-core/src/main/java/com/sun/gjc/spi/DMManagedConnectionFactory.java Sending appserver/jdbc/jdbc-ra/jdbc-core/src/main/java/com/sun/gjc/spi/ManagedConnectionFactory.java Transmitting file data .... Committed revision 51289.
        Hide
        Shalini added a comment -

        Fixed in 3.1.2.

        Sending jdbc/admin/src/main/java/org/glassfish/jdbc/admin/cli/JDBCConnectionPoolManager.java
        Sending jdbc/jdbc-ra/jdbc-core/src/main/java/com/sun/gjc/common/LocalStrings.properties
        Sending jdbc/jdbc-ra/jdbc-core/src/main/java/com/sun/gjc/spi/DMManagedConnectionFactory.java
        Sending jdbc/jdbc-ra/jdbc-core/src/main/java/com/sun/gjc/spi/ManagedConnectionFactory.java
        Transmitting file data ....
        Committed revision 51295.

        Show
        Shalini added a comment - Fixed in 3.1.2. Sending jdbc/admin/src/main/java/org/glassfish/jdbc/admin/cli/JDBCConnectionPoolManager.java Sending jdbc/jdbc-ra/jdbc-core/src/main/java/com/sun/gjc/common/LocalStrings.properties Sending jdbc/jdbc-ra/jdbc-core/src/main/java/com/sun/gjc/spi/DMManagedConnectionFactory.java Sending jdbc/jdbc-ra/jdbc-core/src/main/java/com/sun/gjc/spi/ManagedConnectionFactory.java Transmitting file data .... Committed revision 51295.

          People

          • Assignee:
            Shalini
            Reporter:
            ito_m
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: