Hello everyone,

I have a problem with org.xmlpull.v1.XmlPullParserException.

When receiving a lot of offline messages(with custom offline extension) at the same time, in one out of the ten cases Smack fails to parse packets as they are “corrupted” and i don’t know why.

here is the stacktrace:

aug 25, 2015 11:17:18 AM org.jivesoftware.smack.AbstractXMPPConnection callConnectionClosedOnErrorListener

WARNING: Connection closed with error

org.xmlpull.v1.XmlPullParserException: end tag name must match start tag name from line 1 (position: END_TAG seen …… @1:19741)

at org.xmlpull.mxp1.MXParser.parseEndTag(

at org.xmlpull.mxp1.MXParser.nextImpl(


at org.jivesoftware.smack.util.PacketParserUtils.parseContentDepthWithRoundtrip(Pa

at org.jivesoftware.smack.util.PacketParserUtils.parseContentDepth(PacketParserUti

at org.jivesoftware.smack.util.PacketParserUtils.parseContentDepth(PacketParserUti

at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMP

at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$400( 139)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPCon

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$


i found similar threads “Random” XmlPullParserException

Frequent XmlPullParserException in Smack 3.2

which unfortunately were not solved, in the last one user Flow proposed using callback and to get unparseable stanza, i registered it, however unfortunately it didn’t trigger.

Any ideas on this issue?

Thanks in advance.

Why don’t you show us an example of such an message with an custom offline extension and the code for the provider parsing this custom extension?

Here is our custom provider with the extension itself

public class OfflineMessageReceiveExtension implements ExtensionElement {

** public static final String ELEMENT = “delay”;**

** public static final String NAMESPACE = “urn:xmpp:auth”;**

** private String stamp;**

** public OfflineMessageReceiveExtension(String stamp) {**

** this.stamp = stamp;**

** }**

** public String getStamp() {**

** return stamp;**

** }**

** @Override
public String getElementName() {**

** return ELEMENT;**

** }**

** @Override
public String getNamespace() {**

** return NAMESPACE;**

** }**

** @Override
public CharSequence toXML() {**

** return “<” + ELEMENT + " xmlns=’" + NAMESPACE + “’ stamp=’” + stamp + “’/>”;**

** }**

** public static class Provider extends ExtensionElementProvider {**

** @Override
public Element parse(XmlPullParser xmlPullParser, int i) throws XmlPullParserException, IOException, SmackException {**

** return new OfflineMessageReceiveExtension(xmlPullParser.getAttributeValue(1));**

** }**

** }**


Here is the screenshot of smack debug window, as you can see message tag gets corrupted and only age is seen, and delay xml element also got corrupted. Also id attribute starts withuot apostrof ".

Here message tag again got corrupted


May we are doing something wrong? may be our custome provider is not correct? But as i said this happens approximately one out of ten times.

That does look like the stanzas arrive corrupted at the client.

i have looked using packet sniffer, at the recieved xmpp packets length with error and without, they were the same. And at the server side, as far as i know before sending packets, they are validated. Might it be that parser fails to parse because of the stress?

Could also be cause by a corrupt/not agreed on deflate dictionary. Do you use compression? If so, try to disable it.