Quantcast
Channel: Ignite Realtime: Message List
Viewing all articles
Browse latest Browse all 12162

Re: Getting Vcard OutofMemory

$
0
0

It also happened to me using the aSmack 0.8.10. I caught somes stanzas without being sure which one is the problem. However I noticed in the dump that there were four threads running:

Smack Packet Reader (22)

Smack Packet Reader (24)

Smack Packet Reader (26)

Smack Packet Reader (28)

 

Probably all of this was due to some bug in my connection reuse code or in the smack when it set XmppConnection.packetReader as null when an exception occurs in the xmppConnection.initConnection() or yet in the packet reader threads conditions to close.

 

Nevertheless, I got huge StringsBuffers with "nullnullnullnullnull...." from the dump.

I was caused in the PacketParserUtils.parseContentDepth() due to an exception in the IQ processment causing an infinite loop filling the StringBuffer with parser.getText()returning null.

 

A stanza the breaks the parserContentDepth with OOME is "<iq type="result" to="asdasdasd" from="asdasdas"/>".

 

So, I think the PacketParserUtils.parseContentDepth method is not safe enough. Despite any user code errors, an OOME should never happen.

 

Look the code related

 

classPacketReader{

....

             elseif(parser.getName().equals("iq")){

                        IQiq;

                        try{

                            iq=PacketParserUtils.parseIQ(parser,connection);

                        }catch(Exceptione){

                            Stringcontent=PacketParserUtils.parseContentDepth(parser,parserDepth);

                            UnparsablePacketmessage=newUnparsablePacket(content,e);

                            if(callback!=null){

                                callback.handleUnparsablePacket(message);

                            }

                            continue;

                        }

                        connection.processPacket(iq);

                    }

 

publicclassPacketParserUtils{

...

    publicstaticStringparseContentDepth(XmlPullParserparser,intdepth)throwsXmlPullParserException,IOException{

        StringBuffercontent=newStringBuffer();

        while(!(parser.next()==XmlPullParser.END_TAG&&parser.getDepth()==depth)){

            content.append(parser.getText());

        }

        returncontent.toString();

    }

}

 

 

PS: Why the Openfire is sending me an empty IQ stanza?


Viewing all articles
Browse latest Browse all 12162

Trending Articles