You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Claus Ibsen (Created) (JIRA)" <ji...@apache.org> on 2011/11/10 18:08:51 UTC

[jira] [Created] (AMQ-3588) PooledSession - Can cause memory leak in case many consumers is created by the session

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

        

[jira] [Updated] (AMQ-3588) PooledSession - Can cause memory leak in case many consumers is created by the session

Posted by "Claus Ibsen (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3588?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated AMQ-3588:
-----------------------------

    Attachment: before.png

Before is a test with 50.000 messages showing a memory leak of about 200mb
                
> 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
>              Labels: activemq-pool, camel,
>             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

        

[jira] [Updated] (AMQ-3588) PooledSession - Can cause memory leak in case many consumers is created by the session

Posted by "Claus Ibsen (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3588?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated AMQ-3588:
-----------------------------

    Attachment: AMQ-3588.patch

The patch
                
> 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
>              Labels: activemq-pool, camel,
>             Fix For: 5.6.0
>
>         Attachments: AMQ-3588.patch, after.png, 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

        

[jira] [Updated] (AMQ-3588) PooledSession - Can cause memory leak in case many consumers is created by the session

Posted by "Claus Ibsen (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3588?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated AMQ-3588:
-----------------------------

    Attachment: after.png

After is the same test with 50.000 messages and this time no memory leak
                
> 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
>              Labels: activemq-pool, camel,
>             Fix For: 5.6.0
>
>         Attachments: AMQ-3588.patch, after.png, 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

        

[jira] [Resolved] (AMQ-3588) PooledSession - Can cause memory leak in case many consumers is created by the session

Posted by "Timothy Bish (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3588?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish resolved AMQ-3588.
-------------------------------

    Resolution: Fixed

Patch looks good, applied in trunk.
                
> 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
>              Labels: activemq-pool, camel,
>             Fix For: 5.6.0
>
>         Attachments: AMQ-3588.patch, after.png, 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