ActiveMQ 5.6 Connection Pool Memory Leak Issue
TL;DR Documents a severe memory leak issue with ReentrantLock and PooledConnection, located via jmap monitoring, resolved by upgrading to 5.7 or replacing with Spring connection pool.
Problem Symptoms
Recently, while using ActiveMQ’s connection pool, I discovered a very serious memory leak issue.
Investigation Process
Through jmap monitoring, it can be seen that java.util.concurrent.locks.ReentrantLock and org.apache.activemq.pool.PooledConnection occupy a very large amount of memory, and the growth rate is also very fast.
Root Cause Analysis
After searching online, I found exactly the corresponding ActiveMQ bug report: https://issues.apache.org/jira/browse/AMQ-3997
Solution
This bug has been fixed in version 5.7, so it can be resolved by upgrading the version.
At the same time, there is another solution, which is to use Spring’s connection pool to replace ActiveMQ’s built-in connection pool. The configuration is as follows:
1 | <bean id="jmsConnectionFactory" |
All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.
Comments










