Memory leak in broker when subscribing to a topic using TCP connector + nolocal
-------------------------------------------------------------------------------

                 Key: AMQ-1876
                 URL: https://issues.apache.org/activemq/browse/AMQ-1876
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 5.1.0, 5.2.0
         Environment: Spring 2.5.4
            Reporter: Aaron Pieper
         Attachments: BrokerMemoryLeak.java

I'm encountering what appears to be a memory leak in the BrokerService. The 
symptom is that the BrokerService's memory usage increases with each message 
that is sent to a topic. The memory usage increases proportionally with the 
size of the message, as though each message is being stored permanently in 
memory.

I've included an example which continuously sends messages around 1 megabyte in 
size to a topic with a single subscriber. If you run the included 
BrokerMemoryLeak.java, you should see the following output:

Memory Usage:     0     Memory Percent:   0     Send count: 0     
Memory Usage:     16016576    Memory Percent:   23    Send count: 16    
Memory Usage:     38039368    Memory Percent:   56    Send count: 38    
Memory Usage:     61063196    Memory Percent:   90    Send count: 61    
Memory Usage:     68070448    Memory Percent:   101   Send count: 68    
Memory Usage:     68070448    Memory Percent:   101   Send count: 68    

BrokerService's memory usage climbs steadily until the memory percent hits 100. 
Then, messages stop being sent. There are several ways to make the bug stop 
happening:
  * Switch from using a Topic to a Queue
  * Switch the Broker address to 'vm://foo', so it's not using TCP
  * Set the third argument in the 'createConsumer' call to false. (the noLocal 
argument)
  * Don't register the MessageListener



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to