PooledSession - Can cause memory leak in case many consumers is created by the 
session
--------------------------------------------------------------------------------------

                 Key: AMQ-3588
                 URL: https://issues.apache.org/jira/browse/AMQ-3588
             Project: ActiveMQ
          Issue Type: Bug
          Components: activemq-camel
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
            Priority: Critical
             Fix For: 5.6.0
         Attachments: before.png

See (CAMEL-4657

In the activemq-pool we have a memory leak when a PooledSession is used to 
create many consumers. As each consumer is added to an internal list, which in 
case the session is closed, the list is used to ensure all previously created 
consumers gets closed as well.

However if the session is used to create many consumers, then that internal 
list just keep growing, and causing OOME. See attached screenshots of a before 
vs after with the bug fix.

So to remedy this situation, we should ensure any closed consumer gets removed 
from that internal list. As its already closed, and therefore the session do 
not need to keep track of it anymore.

This bug have existed ever since AMQ-615.

The impact of this bug can be seen in CAMEL-4657, which essentially makes using 
Camel for request/reply over JMS with AMQ and with named replyTo queues (eg not 
temporary) will cause this problem. The problem manifests due Spring DMLC, 
which uses a MessageSelector to only pickup expected reply messages. And 
because the MessageSelector is created once when the consumer is created. We 
need to create a new Consumer, every time a new message is doing request/reply, 
to ensure the Message Selector gets updated. So in that situation many 
consumers get created, which leads to OOME as the list in PooledSession keeps 
growing.

It would be great if this bug fix can be backported to the 5.5 branch as well.

--
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