activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Badri <badrinarayanan.doraisw...@fxall.com>
Subject Out Of Memory Error while running TopicPublisher/TopicListener
Date Tue, 16 Sep 2008 16:33:48 GMT

Hi

I am trying to simulate slow consumer using the classes
(TopicPublisher/TopicListener) provided in examples.

I wanted to see if Web Console prints the Advisory topic for Slow Consumer.
But I am facing Out Of Memory Error & the consumer stops abruptly.

Following are changes I did:

activemq.xml:

        <transportConnectors>
            <transportConnector name="openwire"
uri="tcp://localhost:61616?maxInactivityDuration=-1"/>
        </transportConnectors>


TopicListener: I added a sleep of 1000 to induce some slowness.
            if (++count % 1000 == 0) {
                System.out.println("Received " + count + " messages.");
				try
				{
					Thread.sleep(1000);
				}
				catch (Exception e) 
				{
					
				}
            }

I give java -Xmx256m -Xms128m when using TopicListener.
After maybe 5 minutes it crashes. After receiving anywhere between 15-20
batches of 1000 messages, it crashes.

Exception:
Received 9000 messages.
Received 10000 messages.
javax.jms.JMSException: Unexpected error occured
        at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSuppo
rt.java:62)
        at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnect
ion.java:1255)
        at
org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1659)
        at
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProdu
cer.java:227)
        at
org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessa
geProducerSupport.java:241)
        at TopicListener.onMessage(TopicListener.java:96)
        at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageC
onsumer.java:983)
        at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionE
xecutor.java:122)
        at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionEx
ecutor.java:192)
        at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.
java:122)
        at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.ja
va:43)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:885)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:907)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.IOException: Unexpected error occured
        at
org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:
191)
        ... 1 more
Caused by: java.lang.OutOfMemoryError: Java heap space
        at
org.apache.activemq.openwire.v3.BaseDataStreamMarshaller.tightUnmarsh
alByteSequence(BaseDataStreamMarshaller.java:440)
        at
org.apache.activemq.openwire.v3.MessageMarshaller.tightUnmarshal(Mess
ageMarshaller.java:68)
        at
org.apache.activemq.openwire.v3.ActiveMQMessageMarshaller.tightUnmars
hal(ActiveMQMessageMarshaller.java:67)
        at
org.apache.activemq.openwire.v3.ActiveMQBytesMessageMarshaller.tightU
nmarshal(ActiveMQBytesMessageMarshaller.java:67)
        at
org.apache.activemq.openwire.OpenWireFormat.tightUnmarshalNestedObjec
t(OpenWireFormat.java:453)
        at
org.apache.activemq.openwire.v3.BaseDataStreamMarshaller.tightUnmarsa
lNestedObject(BaseDataStreamMarshaller.java:126)
        at
org.apache.activemq.openwire.v3.MessageDispatchMarshaller.tightUnmars
hal(MessageDispatchMarshaller.java:72)
        at
org.apache.activemq.openwire.OpenWireFormat.doUnmarshal(OpenWireForma
t.java:362)
        at
org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.
java:276)
        at
org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTranspo
rt.java:209)
        at
org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.jav
a:201)
        at
org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:
184)
        ... 1 more
Received 1000 messages.
Received 2000 messages.

TopicPublisher:
 private long batch(int msgCount) throws Exception {
 // Commented out call to waitForCompletion
 // waitForCompletion();
}

QN 1) I just want to know if I am configuring something wrong. Or should I
increase -Xmx512m when running TopicListener to get rid of OOME?

QN 2) Will the advisory topic:
ActiveMQ.Advisory.SlowConsumer.Topic.topictest.messages appear only if the
consumer starts discarding messages? What is the basis for this topic to
appear in Web console?

Thanks for your time & reply.
-- 
View this message in context: http://www.nabble.com/Out-Of-Memory-Error-while-running-TopicPublisher-TopicListener-tp19515522p19515522.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message