Memory leak when to use camel-jms consumer with CACHE_SESSSION and pooled connection(messaginghub/pooled-jms)
Issue
- 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 :
- Or When to use replyToType=shared :
- When to use replyToType=shared, the cacheLevel will be “CACHE_SESSSION” as default .
- When to use cacheLevelName=CACHE_SESSSION :
- org.ops4j.pax.jms.service.PooledConnectionFactoryFactory use messaginghub/pooled-jms internally.
- A simple camel route like the following will reproduce the problem:
-
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
Environment
- Red Hat Fuse 7.8
- camel-jms
- org.ops4j.pax.jms.service.PooledConnectionFactoryFactory(messaginghub/pooled-jms) is used
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.