You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by mcacker <mi...@pgi.com> on 2016/09/22 17:53:18 UTC

Potential memory leak with local queue consumer

Hi,

I have a scenario where I have a queue, interServerQueue, for which I create
a local connection and consumer.  The queue is sent messages by local and
remote producers.  Messages sent to the queue are received and processed by
the local consumer.

A heap dump, however, shows 2 QueueImpl objects, one with a consumer and one
without.  The one with a consumer has retained no messages in the
messageReferences queue, whereas the one without the consumer is
accumulating messages, and it doesn't look like they are ever getting
cleaned up.

I'm concerned that this is a memory leak, and is very similar (a QueueImpl
without a consumer) to that reported in
http://activemq.2283324.n4.nabble.com/potential-memory-leak-when-using-STOMP-protocol-td4716643.html.

My configuration:

<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns="urn:activemq"
               xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">

   <jms xmlns="urn:activemq:jms">

	    <topic name="asyncEvents"/>
	    <queue name="interServerQueue"/>
		<topic name="notificationsTopic"/>
      
   </jms>
   
   <core xmlns="urn:activemq:core">

		<queues>
			<queue name="interServerQueue">
				<address>jms.queue.interServerQueue</address>
				<durable>false</durable>
			</queue>
		</queues>
		
	 	<persistence-enabled>false</persistence-enabled>
	 
		<management-address>jms.queue.hornetq.management</management-address>
	
<management-notification-address>jms.topic.notificationsTopic</management-notification-address>
	
		<connectors>
			<connector name="in-vm">vm://0</connector>
 		</connectors>
	
		<acceptors>
			
			<acceptor name="in-vm">vm://0</acceptor>
			<acceptor name="netty">tcp://0.0.0.0:5445</acceptor>
			<acceptor
name="stomp-acceptor">tcp://0.0.0.0:61613?protocols=STOMP</acceptor>	 
	 	</acceptors>
	
		<security-enabled>false</security-enabled>

 	</core>

</configuration>

<http://activemq.2283324.n4.nabble.com/file/n4716809/Capture.png> 



--
View this message in context: http://activemq.2283324.n4.nabble.com/Potential-memory-leak-with-local-queue-consumer-tp4716809.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Potential memory leak with local queue consumer

Posted by mcacker <mi...@pgi.com>.
Thanks, 

that was it.  For some reason, I thought I had to set the <durable> element
on a core configuration, but I've added that the the JMS configuration and
it works fine.

Mitchell



--
View this message in context: http://activemq.2283324.n4.nabble.com/Potential-memory-leak-with-local-queue-consumer-tp4716809p4716812.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Potential memory leak with local queue consumer

Posted by Justin Bertram <jb...@apache.com>.
My reading of your configuration indicates that you're actually creating the extra queue yourself.  When you configure a JMS queue like this:

   <jms xmlns="urn:activemq:jms">
      <queue name="interServerQueue"/>      
   </jms>

This gets turned into a core queue named "jms.queue.interServerQueue" mapped to an core address also named "jms.queue.interServerQueue".  So that's queue #1.

When you configure a core queue like this:

   <queue name="interServerQueue">
      <address>jms.queue.interServerQueue</address>
      <durable>false</durable>
   </queue>

This creates a core queue name "interServerQueue" mapped to a core address named "jms.queue.interServerQueue".  That's queue #2.

Since both queue #1 and #2 are mapped to the same address (i.e. "jms.queue.interServerQueue") they will both get all the same messages.  However, my guess is that your application is only consuming messages from queue #1 (i.e. the "JMS" queue) which means messages build up in queue #2 since there's no client to consume them.

Ultimately I think this is a misconfiguration.  Remove the core queue you've configured and see how it goes.


Justin

----- Original Message -----
From: "mcacker" <mi...@pgi.com>
To: users@activemq.apache.org
Sent: Thursday, September 22, 2016 12:53:18 PM
Subject: Potential memory leak with local queue consumer

Hi,

I have a scenario where I have a queue, interServerQueue, for which I create
a local connection and consumer.  The queue is sent messages by local and
remote producers.  Messages sent to the queue are received and processed by
the local consumer.

A heap dump, however, shows 2 QueueImpl objects, one with a consumer and one
without.  The one with a consumer has retained no messages in the
messageReferences queue, whereas the one without the consumer is
accumulating messages, and it doesn't look like they are ever getting
cleaned up.

I'm concerned that this is a memory leak, and is very similar (a QueueImpl
without a consumer) to that reported in
http://activemq.2283324.n4.nabble.com/potential-memory-leak-when-using-STOMP-protocol-td4716643.html.

My configuration:

<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns="urn:activemq"
               xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">

   <jms xmlns="urn:activemq:jms">

	    <topic name="asyncEvents"/>
	    <queue name="interServerQueue"/>
		<topic name="notificationsTopic"/>
      
   </jms>
   
   <core xmlns="urn:activemq:core">

		<queues>
			<queue name="interServerQueue">
				<address>jms.queue.interServerQueue</address>
				<durable>false</durable>
			</queue>
		</queues>
		
	 	<persistence-enabled>false</persistence-enabled>
	 
		<management-address>jms.queue.hornetq.management</management-address>
	
<management-notification-address>jms.topic.notificationsTopic</management-notification-address>
	
		<connectors>
			<connector name="in-vm">vm://0</connector>
 		</connectors>
	
		<acceptors>
			
			<acceptor name="in-vm">vm://0</acceptor>
			<acceptor name="netty">tcp://0.0.0.0:5445</acceptor>
			<acceptor
name="stomp-acceptor">tcp://0.0.0.0:61613?protocols=STOMP</acceptor>	 
	 	</acceptors>
	
		<security-enabled>false</security-enabled>

 	</core>

</configuration>

<http://activemq.2283324.n4.nabble.com/file/n4716809/Capture.png> 



--
View this message in context: http://activemq.2283324.n4.nabble.com/Potential-memory-leak-with-local-queue-consumer-tp4716809.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.