Uploaded image for project: 'ActiveMQ'
  1. ActiveMQ
  2. AMQ-6273

ReconnectionPolicy.getNextDelay(int attempt) always returns zero when maxReconnectAttempts/maxInitialConnectAttempts == ReconnectionPolicy.INFINITE

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.12.1
    • Fix Version/s: 5.14.0
    • Component/s: Connector
    • Labels:
      None
    • Environment:

      WebLogic 10.3.6, HotSpot JDK 1.7

    • Flags:
      Important

      Description

      The v.5.12.1 release of class org.apache.activemq.network.jms.JmsConnector contains a defect within method private void doInitializeConnection(boolean local) throws Exception that causes the attempt variable to
      always retain a value of zero if ReconnectionPolicy.maxReconnectAttempts/maxInitialConnectAttempts == ReconnectionPolicy.INFINITE. (irrespective of the actual number of loop iterations)

      This indirectly prevents the connector from using any of the following ReconnectionPolicy configuration properties:

      private long initialReconnectDelay = 1000L;
      private long maximumReconnectDelay = 30000;
      private boolean useExponentialBackOff = false;
      private double backOffMultiplier = 2.0;

      The defect is triggered by inclusion of increment operator for attempt variable within do/while loop condition evaluation. Line 630 of class JmsConnector uses short-circuit evaluation and this prevents value from being incremented whenever maxRetries == INFINITE evaluates to true:

      while ((maxRetries == INFINITE || maxRetries > ++attempt) && !connectionService.isShutdown());

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ben_nisbet Ben Nisbet
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: