Possible leak in ManangedRegionBroker unregisterDestination
-----------------------------------------------------------

                 Key: AMQ-3737
                 URL: https://issues.apache.org/jira/browse/AMQ-3737
             Project: ActiveMQ
          Issue Type: Bug
          Components: JMX
    Affects Versions: 5.5.1
            Reporter: Timothy Bish
            Assignee: Timothy Bish
            Priority: Minor
             Fix For: 5.6.0


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.

{noformat}
    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);
                }
            }
        }
    }
{noformat}

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.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to