Uploaded image for project: 'AMQ Clients'
  1. AMQ Clients
  2. ENTMQCL-2977

[jms-pool] Memory leak when to use camel-jms consumer with CACHE_SESSSION and pooled connection(messaginghub/pooled-jms)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.10.1.B1
    • None
    • jms-pool
    • None
    • False
    • False
    • +
      • Avoid to use “CACHE_SESSSION”, (i.e. “CACHE_CONSUMER” or “CACHE_NONE”
      • Or avoid to use pooled connection(messaginghub/pooled-jms)
    • Hide
      1.  setup broker.xml on AMQ Broker
      2. purge request queue, response queue and the expiry queue, if necessary.
      3. Execute the following camel route
        • Use cacheLevelName=CACHE_SESSSION : <to uri="jms:queue:requestqueue?cacheLevelName=CACHE_SESSSION"/>
        • Or use replyToType=shared : <to uri="jms:queue:requestqueue?replyTo=replyqueue&replyToType=shared"/>
      Show
       setup broker.xml on AMQ Broker purge request queue, response queue and the expiry queue, if necessary. Execute the following camel route Use cacheLevelName=CACHE_SESSSION : <to uri="jms:queue:requestqueue?cacheLevelName=CACHE_SESSSION"/> Or use replyToType=shared : <to uri="jms:queue:requestqueue?replyTo=replyqueue&replyToType=shared"/>

    Description

      [Problem]

      • Memory leak when to use camel-jms consumer with CACHE_SESSSION and pooled connection(messaginghub/pooled-jms)
        • A simple camel route like the following will reproduce the problem:
          • When to use cacheLevelName=CACHE_SESSSION : <to uri="jms:queue:requestqueue?cacheLevelName=CACHE_SESSSION"/>
          • Or When to use replyToType=shared : <to uri="jms:queue:requestqueue?replyTo=replyqueue&replyToType=shared"/>
            • When to use replyToType=shared, the cacheLevel will be “CACHE_SESSSION” as default .
        • org.ops4j.pax.jms.service.PooledConnectionFactoryFactory use messaginghub/pooled-jms internally.
      • With leaks by this problem, the number of consumers(org.messaginghub.pooled.jms.JmsPoolMessageConsumer and its raw javax.jms.MessageConsumer objects) continues to gradually increase, and the memory continues to grow.
        • If lucky, Fuse will freeze for several tens of seconds when heap size reaches its maximum. Then, due to various timeout errors[1], the connection is closed, the resource is released. And the leaks begin repeatedly.
        • If unlucky, Fuse will crash with out of memory error.
        • When to use replyToType=shared:
          • If the heap is about 7GB, 50000 Consumers will be created to be out of memory error.
          • When to sends 1000 messages per second, the errors(several kind of timeout errors etc,.) by insufficient memory are reproduced in about three minute.
        • When to use cacheLevelName=CACHE_SESSSION:
          • It takes more time to reproduce because the consumer uses less memory than when replyToType=shared.
      • FYI, I've tested several patterns:
        • [PROBLEM       ] camel-jms request/reply route ===> messaginghub/pooled-jms connection pool  ===> Artemis connection factory ===> Artemis server
        • [PROBLEM       ] camel-jms request/reply route ===> messaginghub/pooled-jms connection pool  ===> Classic connection factory ===>  Classic server
        • [NO PROBLEM] camel-jms request/reply route ===> Classic connection pool  ===> Classic connection factory ===>  Classic server
        • [NO PROBLEM] camel-jms request/reply route ===> Artemis connection factory ===> Artemis server
        • [NO PROBLEM] camel-jms request/reply route ===> Classic connection factory  ===> Classic server
        • ※ explanatory notes
          • messaginghub/pooled-jms connection pool = org.messaginghub.pooled.jms.JmsPoolConnectionFactory
          • Classic connection pool = org.apache.activemq.pool.PooledConnectionFactory
          • Artemis connection factory = org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory
          • Classic connection factory = org.apache.activemq.ActiveMQConnectionFactory

      [Memory leak location]

      [Problem cause]

      [Environment]

      • Red Hat Fuse 7.8 on Karaf
        • camel-jms
        • org.ops4j.pax.jms.service.PooledConnectionFactoryFactory(messaginghub/pooled-jms) is used
      • Red Hat AMQ Broker 7.8 as a messaging broker

      Attachments

        Activity

          People

            rhn-support-tbish Tim Bish
            rhn-support-tyamashi Tomonari Yamashita
            Jiri Daněk Jiri Daněk
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: