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

Possible leak in ManangedRegionBroker unregisterDestination

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 5.5.1
    • 5.6.0
    • JMX
    • None

    Description

      Method unregisterDestination in ManagedRegionBroker is supposed to remove the SlowConsumerStrategy MBean on the destination it removes if one exists but the code is incorrect and will never actually do so.

          protected void unregisterDestination(ObjectName key) throws Exception {
      
              DestinationView view = null;
              removeAndRemember(topics, key, view);
              removeAndRemember(queues, key, view);
              removeAndRemember(temporaryQueues, key, view);
              removeAndRemember(temporaryTopics, key, view);
              if (registeredMBeans.remove(key)) {
                  try {
                      managementContext.unregisterMBean(key);
                  } catch (Throwable e) {
                      LOG.warn("Failed to unregister MBean: " + key);
                      LOG.debug("Failure reason: " + e, e);
                  }
              }
              if (view != null) {
                  key = view.getSlowConsumerStrategy();
                  if (key!= null && registeredMBeans.remove(key)) {
                      try {
                          managementContext.unregisterMBean(key);
                      } catch (Throwable e) {
                          LOG.warn("Failed to unregister slow consumer strategy MBean: " + key);
                          LOG.debug("Failure reason: " + e, e);
                      }
                  }
              }
          }
      

      Attempts to pass the DestinationView into removeAndRemember() as an 'out' parameter so it never ends up getting set to anything and the last if will never be executed because view will always be null.

      Attachments

        Activity

          People

            gtully Gary Tully
            tabish Timothy A. Bish
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: