QueueImpl memory leak
mackerman Sep 25, 2012 8:20 PMHi, we have a dual server JBoss 7.1.1.Final system, using hornetq 2.2.14.Final for inter-server communication and event notification. The servers are standalone servers and the application takes care of broadcasting messages to the same topic running on each server.
After the system has been running and processing messages for a while, a heap dump shows that both servers have accumulated quite a number of org.hornetq.core.server.impl.QueueImpl objects, up to thousands if it has been running for a while, taking up to 500M. They all appear to be duplicates of the topic. Does anyone have any idea what is going on here? Could it have anything to do with <connection-ttl>120000</connection-ttl>?
Upon initialization, I observe that one queue (/queue/interServerQueue) is instantated, and 2 topics (/topic/asyncEvents). The second topic instance is created as a result of a CREATE_QUEUE packet. Is this expected behavior? I have been unable thus far to determine how all the other instances are created.
our horneq-jms.xml :
<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
<connection-factory name="ConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm" />
</connectors>
<entries>
<entry name="ConnectionFactory" />
</entries>
<connection-ttl>120000</connection-ttl>
<client-failure-check-period>15000</client-failure-check-period>
</connection-factory>
<topic name="asyncEvents">
<entry name="/topic/asyncEvents"/>
</topic>
<queue name="interServerQueue">
<entry name="/queue/interServerQueue"/>
<durable>false</durable>
</queue>
</configuration>
hornetq-configuration.xml:
<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
<persistence-enabled>false</persistence-enabled>
<connectors>
<connector name="in-vm">
<factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory
</factory-class>
</connector>
<connector name="netty-connector">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory
</factory-class>
<param key="port" value="5445" />
</connector>
</connectors>
<!-- Acceptors -->
<acceptors>
<acceptor name="in-vm">
<factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory
</factory-class>
</acceptor>
<acceptor name="netty-acceptor">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory
</factory-class>
<param key="port" value="5445" />
<param key="host" value="${build.acceptor.address}" />
</acceptor>
<acceptor name="stomp-acceptor">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory
</factory-class>
<param key="protocol" value="stomp" />
<param key="port" value="61613" />
<param key="host" value="${build.acceptor.address}" />
</acceptor>
</acceptors>
<security-settings>
<!--security for example queue -->
<security-setting match="#">
<permission type="createDurableQueue" roles="guest" />
<permission type="deleteDurableQueue" roles="guest" />
<permission type="createNonDurableQueue" roles="guest" />
<permission type="deleteNonDurableQueue" roles="guest" />
<permission type="consume" roles="guest" />
<permission type="send" roles="guest" />
</security-setting>
</security-settings>
</configuration>
Connections, Sessions and Producers are created like this:
HornetQConnectionFactory cf = HornetQJMSClient.createConnectionFactoryWithoutHA(getFactoryType(), getTransportConfiguration());
connection = cf.createConnection();
connection.start();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
destination = HornetQDestination.fromAddress(destinationName);
producer = session.createProducer(destination);
// set time to live for topics, queued messages should all be consumed
if (JMSFactoryType.TOPIC_CF.equals(getFactoryType()))
producer.setTimeToLive(30000);
producer.setDisableMessageID(true);
producer.setDisableMessageTimestamp(true);
Messages are sent like this:
TextMessage message = session.createTextMessage();
message.setStringProperty(org.hornetq.rest.HttpHeaderProperty.CONTENT_TYPE,
MediaType.APPLICATION_JSON);
message.setText(strmsg);
message.setStringProperty(propName, propValue);
try {
producer.send(message);
if (session.getTransacted())
session.commit();
} catch (Exception e) {
log.error(...);
}
The system runs on CentOS 6.3, JBoss 7.1.1.Final, HornetQ 2.2.14.Final, JRE 1.6.0_30.
Thanks, Mitchell