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 “”.
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
class PacketReader {
…
else if (parser.getName().equals(“iq”)) {
IQ iq;
try {
iq = PacketParserUtils.parseIQ(parser, connection);
} catch (Exception e) {
String content = PacketParserUtils.parseContentDepth(parser, parserDepth);
UnparsablePacket message = new UnparsablePacket(content, e);
if (callback != null) {
callback.handleUnparsablePacket(message);
}
continue;
}
connection.processPacket(iq);
}
public class PacketParserUtils {
…
public static String parseContentDepth(XmlPullParser parser, int depth) throws XmlPullParserException, IOException {
StringBuffer content = new StringBuffer();
while (!(parser.next() == XmlPullParser.END_TAG && parser.getDepth() == depth)) {
content.append(parser.getText());
}
return content.toString();
}
}
PS: Why the Openfire is sending me an empty IQ stanza?