Hi,

I've been testing the XMPP Camel component and ran into an OutOfMemoryError
after I send about 6600 packets. I have a simple client that just sends
messages one after another and the messages are roughly 4KB in size. 

My client code is pretty simple:

-------------
public void sendMessages(int numOfMessages, int messageSize, String fileStr)
throws Exception {

                CamelContext context = new DefaultCamelContext();
                context.start();
                
                Endpoint endpoint = context.getEndpoint(uri);
            Exchange exchange = endpoint.createExchange(ExchangePattern.InOut);
                    
            Producer producer = endpoint.createProducer();
            producer.start();
                
                for (int i = 0; i < numOfMessages; i++) {
                        String s = fileStr;
                        exchange.getIn().setBody(s);
                        producer.process(exchange);
                        
                        if ( (i+1) % 100 == 0 ) {
                                System.out.println("Messages Sent: " + i);
                        }
                        
                        Thread.sleep(5);
                }
            producer.stop();
            context.stop();
        }

And the error I get is:

-------------------------
Messages Sent: 6499
Messages Sent: 6599
Exception in thread "Smack Packet Writer (0)" java.lang.OutOfMemoryError:
Java heap space
        at
java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:99)
        at 
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:518)
        at java.lang.StringBuilder.append(StringBuilder.java:190)
        at
org.jivesoftware.smack.util.StringUtils.escapeForXML(StringUtils.java:301)
        at org.jivesoftware.smack.packet.Message.toXML(Message.java:314)
        at 
org.jivesoftware.smack.PacketWriter.writePackets(PacketWriter.java:258)
        at org.jivesoftware.smack.PacketWriter.access$000(PacketWriter.java:40)
        at org.jivesoftware.smack.PacketWriter$1.run(PacketWriter.java:87)
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        at java.lang.String.<init>(String.java:208)
        at java.lang.StringBuilder.toString(StringBuilder.java:431)
        at
org.apache.camel.component.xmpp.XmppGroupChatProducer.process(XmppGroupChatProducer.java:56)
        at
edu.mit.ll.test.clients.XMPPCamelTestPublisher.sendMessages(XMPPCamelTestPublisher.java:132)
        at
edu.mit.ll.test.clients.XMPPCamelTestPublisher.main(XMPPCamelTestPublisher.java:169)


I've tried it with the 1.6 release and the latest 2.0 SNAPSHOT. The smack
and smackx components I use are 3.0.4. I'm also running an Openfire server
on a remote machine.

Has anyone seen this or might be able to help?

Much thanks,
Orton
-- 
View this message in context: 
http://www.nabble.com/Camel-XMPP-1.6-2.0---OutOfMemoryError%3A-Java-heap-space-tp22485629p22485629.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to