glassfish
  1. glassfish
  2. GLASSFISH-20697

If JMS connection factory setting is changed, all pooled connections are disconnected

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.1
    • Component/s: jms
    • Labels:
      None
    • Environment:

      Windows 7
      Glassfish 4.0
      JDK 7

      Description

      When a JMS connection is created on Web or EJB container, connections are pooled in the JMS connection factory.

      If a JMS connection factory setting (ie, maximum pool size) is changed, all the pooled connections are disconnected.

      Conditions for reproducing bug:
      (1) Create a new connection using JMS connection factory on Web or EJB container. AND
      (2) Update following settings for the first time.

      • Initial and Minimum Pool Size
      • Maximum Pool Size
      • Pool Resize Quantity
      • Idle Timeout
      • Max Wait Time
      • On Any Failure
      • Transaction Support
      • Additional Properties

      Note that the connections are not disconnected when updating the JMS connection factory setting on second time or later while the server instance is running.

      Steps reproduce:
      1. Create a Connection Factory.
      asadmin create-jms-resource --restype javax.jms.Queue --property Name=PhysicalQueue jms/Queue
      asadmin create-jms-resource --restype javax.jms.ConnectionFactory jms/ConnectionFactory

      2. Set the Connection Pool Initial and Minimum Pool Size. This is set as 8 so that it is easier to find bug which causes disconnection in pool.
      asadmin set resources.connector-connection-pool.jms/ConnectionFactory-Connection-Pool.steady-pool-size=8

      3. Check the number of connections.
      imqcmd list cxn

      4. Deploy the test program.
      asadmin deploy cfdisconnected.war

      5. Open web browser and connect to the Servlet.
      http://localhost:8080/cfdisconnected/HelloWorld

      6. Check the number of connections.
      imqcmd list cxn
      There are 8 more connections compared with step 3.

      7. Change the Maximum Pool Size from default (250) to 16.
      asadmin set resources.connector-connection-pool.jms/ConnectionFactory-Connection-Pool.max-pool-size=16

      8. Check the number of connections.
      imqcmd list cxn
      The bug is found at the step. The 8 connections have been disconnected and not listed.
      Expected result is that the 8 connections are maintained.

        Activity

        Hide
        tak09 added a comment -
        Show
        tak09 added a comment - Test program https://www.dropbox.com/sh/s0ylklhq88fggbc/fxIbL9t3OG
        Hide
        tak09 added a comment -

        Please download the cfdisconnected.war from the above site.

        Show
        tak09 added a comment - Please download the cfdisconnected.war from the above site.
        Hide
        David Zhao added a comment -

        I think it is not a bug. If you repeat step 5 and 6 after step 8, then you will see the servlet can get new jms connections successfully and steady pool size becomes 8 again. The pooled connections are managed by JCA runtime internally, the number of active connections is dynamic based on an algorithm. So when the pool properties are changed, the behaviors of existing connections - whether the number changes, or destroy/recreate, are expected.

        Show
        David Zhao added a comment - I think it is not a bug. If you repeat step 5 and 6 after step 8, then you will see the servlet can get new jms connections successfully and steady pool size becomes 8 again. The pooled connections are managed by JCA runtime internally, the number of active connections is dynamic based on an algorithm. So when the pool properties are changed, the behaviors of existing connections - whether the number changes, or destroy/recreate, are expected.
        Hide
        tak09 added a comment - - edited

        Hi David,

        I still think it is a bug as the same problem does not ocurr in JDBC connection pool.

        I have created a sample program which does the following.

        • Get Connction from JDBC Connection Pool.
        • Wait 60 sec. A user updates JDBC setting from Glassfish WebAdmin.
        • SQL is executed successfully as connection is maintained.

        However,
        java.sql.SQLNonTransientConnectionException:
        Caused by: org.apache.derby.client.am.SqlException
        ocurrs if disconnected.

        I have created a test program.

        Please try this.
        1. Start glassfish and database
        asadmin start-domain
        asadmin start-database

        2. Deploy the test program.
        asadmin deploy HelloJDBC.war

        3. Open URL in browser.
        http://localhost:8080/HelloJDBC/HelloWorldJDBC

        4. Change JDBC connection pool setting while waiting 60 sec message is displayed.

        5. SQL is executed successfully.

        I have also done the same step in JMS.
        Please try this.
        1. Deploy the test program.
        asadmin deploy HelloJMS.war

        2. Open URL in browser.
        http://localhost:8080/HelloJDBC/HelloWorldJDBC

        3. Change JMS connection pool setting while waiting 60 sec message is displayed.

        4. Error message is displayed due to disconnection.

        If you repeat step 2-4 again, you will not see the error on second time and after. Why it does not work on 1st time?

        Show
        tak09 added a comment - - edited Hi David, I still think it is a bug as the same problem does not ocurr in JDBC connection pool. I have created a sample program which does the following. Get Connction from JDBC Connection Pool. Wait 60 sec. A user updates JDBC setting from Glassfish WebAdmin. SQL is executed successfully as connection is maintained. However, java.sql.SQLNonTransientConnectionException: Caused by: org.apache.derby.client.am.SqlException ocurrs if disconnected. I have created a test program. Please try this. 1. Start glassfish and database asadmin start-domain asadmin start-database 2. Deploy the test program. asadmin deploy HelloJDBC.war 3. Open URL in browser. http://localhost:8080/HelloJDBC/HelloWorldJDBC 4. Change JDBC connection pool setting while waiting 60 sec message is displayed. 5. SQL is executed successfully. I have also done the same step in JMS. Please try this. 1. Deploy the test program. asadmin deploy HelloJMS.war 2. Open URL in browser. http://localhost:8080/HelloJDBC/HelloWorldJDBC 3. Change JMS connection pool setting while waiting 60 sec message is displayed. 4. Error message is displayed due to disconnection. If you repeat step 2-4 again, you will not see the error on second time and after. Why it does not work on 1st time?
        Hide
        tak09 added a comment -
        Show
        tak09 added a comment - Please download the test programs at this website. https://www.dropbox.com/s/jzjmwx3dn03ucrc/HelloJDBC.war https://www.dropbox.com/s/021ugdp7ien7xvn/HelloJMS.war
        Hide
        David Zhao added a comment -

        tak09,

        Should step 5.2 in your latest case be accessing HelloJMS instead?

        5.2. Open URL in browser.
        http://localhost:8080/HelloJMS/HelloWorld

        Show
        David Zhao added a comment - tak09, Should step 5.2 in your latest case be accessing HelloJMS instead? 5.2. Open URL in browser. http://localhost:8080/HelloJMS/HelloWorld
        Hide
        David Zhao added a comment - - edited

        The latest new added case shows a Connector Runtime issue that it filters out jmsra MCF addresslist=localhost property when pool is redeployed, but the property is not filtered out when the pool is initialized, thus the first pool redeployment will trigger recreating all the connections in the pool.

        Show
        David Zhao added a comment - - edited The latest new added case shows a Connector Runtime issue that it filters out jmsra MCF addresslist=localhost property when pool is redeployed, but the property is not filtered out when the pool is initialized, thus the first pool redeployment will trigger recreating all the connections in the pool.
        Hide
        tak09 added a comment -

        Hi David,

        Sorry, I made mistake while writing the instructions. HelloJMS is correct.

        Show
        tak09 added a comment - Hi David, Sorry, I made mistake while writing the instructions. HelloJMS is correct.
        Hide
        Jagadish added a comment -

        Thanks David and Tak09 for the investigation and steps to reproduce the issue.
        I have now provided a fix.

        FIX INFORMATION :

        svn log -v -r 62432
        ------------------------------------------------------------------------
        r62432 | jr158900 | 2013-07-31 10:56:57 +0530 (Wed, 31 Jul 2013) | 6 lines
        Changed paths:
        M /trunk/main/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/connectors/service/ConnectorConnectionPoolAdminServiceImpl.java
        M /trunk/main/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/connectors/util/ConnectorDDTransformUtils.java
        M /trunk/main/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/deployer/ConnectorConnectionPoolDeployer.java

        GLASSFISH-20697 : If JMS connection factory setting is changed, all pooled connections are disconnected

        + Commented unused methods.

        Show
        Jagadish added a comment - Thanks David and Tak09 for the investigation and steps to reproduce the issue. I have now provided a fix. FIX INFORMATION : svn log -v -r 62432 ------------------------------------------------------------------------ r62432 | jr158900 | 2013-07-31 10:56:57 +0530 (Wed, 31 Jul 2013) | 6 lines Changed paths: M /trunk/main/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/connectors/service/ConnectorConnectionPoolAdminServiceImpl.java M /trunk/main/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/connectors/util/ConnectorDDTransformUtils.java M /trunk/main/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/deployer/ConnectorConnectionPoolDeployer.java GLASSFISH-20697 : If JMS connection factory setting is changed, all pooled connections are disconnected + Commented unused methods.

          People

          • Assignee:
            Jagadish
            Reporter:
            tak09
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: