activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Makarenko <l...@softline.kiev.ua>
Subject ActiveMQ 4.x memory leak in multithreaded applications
Date Sat, 19 Aug 2006 11:20:30 GMT

Hello everyone!
I discovered some strange behavior of ActiveMQ 4.x in terms of
MessageConsumer handling. It seamed that ActiveMQ 4.x versions in some cases
do not release MessageConsumers while versions 3.2.x do.
I have application that must work with limited system resources such as
number of threads and number of simultaneously running tasks on message
processing. A cannot use asynchronous message processing instead I have to
use thread pool with 3 threads. Every thread creates MessageConsumer and
tries to process message in case of failures massage is rolled back to
queue. MessageConsumers are created to support independant transactions for
every thread.
Initially I was using ActiveMQ 4.0.1   Spring’s JmsTemplate and
TransactionTemplate. But after day or two of work I’ve got OutOfMemoryError.
I tried to dig what’s going on with YourKit Java Profiler and discovered
that ActiveMQMessageConsumer objects that was created with JmsTemplate in
each thread are still in memory and never get garbage collected. I thought
it’s a Spring bug but when I rewrote application to use clean JMS the
situation do not changed.
I am attaching screen shots from YourKit Java Profiler with Spring and
without; along with sample application. It seams that ActiveMQ leaks
MessageConsumers. Again it does not happen with versions 3.2.2.

http://gis.softline.kiev.ua/sample.zip sample application 

Profiler results on application with Spring

http://gis.softline.kiev.ua/profiler_1.gif  
Profiler results on application without Spring

http://gis.softline.kiev.ua/profiler_2.gif  
-- 
View this message in context: http://www.nabble.com/ActiveMQ-4.x-memory-leak-in-multithreaded-applications-tf2131839.html#a5883585
Sent from the ActiveMQ - User forum at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message