"Random" XmlPullParserException

Hi all,

I’m using XMPP and Smack for some machine-to-machine communication. I’m running 3-4 users repeating the same scenario over and over again. Every few times I get this exception below which results in users appearing unavailable to all others. It seems inconsistent and random cos as far as I see I don’t change the input. Could it be related to the stress? I mean when too many message arrive at the same time or something like that?

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

at org.xmlpull.mxp1.MXParser.parseEndTag(MXParser.java:1689)

at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1172)

at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:368)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)

Any idea?

Thanks.

Hi dsqgie2009

hava you fixed this problem? i hava the same problem.

Hi everyone:

** I’m testing the my own openfire plugin pressure. I use smack3.2 lib as the testClient lib. I create a threadPool in the testClient and add 100 clientThread(login,sendpresence,request buiness data) in the threadPool , I can always see like the following error:**

**org.xmlpull.v1.XmlPullParserException: start tag unexpected character < (position: TEXT seen …irportName><routeList<… @1:546508) **

** at org.xmlpull.mxp1.MXParser.parseStartTag(MXParser.java:1803)**

** at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1127)**

** at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)**

** at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:325)**

** at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)**

** at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)**

**org.xmlpull.v1.XmlPullParserException: end tag name must be the same as start tag from line 1 (position: TEXT seen …1\ufffd\ufffd-\u90d1… @1:548654) **

** at org.xmlpull.mxp1.MXParser.parseEndTag(MXParser.java:1699)**

** at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1131)**

** at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)**

** at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:325)**

** at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)**

** at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)**

**org.xmlpull.v1.XmlPullParserException: unexpected character in markup < (position: END_TAG seen …53" from="test3@172.17.35.110/Smack" to="test74@172.17.35.110"/><<… @1:696437) **

test74client[test74] enter in conn closed on error

** at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1261)**

** at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)**

** at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:325)**

** at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)**

** at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)**


** these all indicated parser find a error packet, but actually ,i say from the serve log ,the server deliver the fully correct message ,like the third exception: i see from server log :**

**server **

sent:

sent:

**the second exception : the server log actually is… … …
**

**
**

**( i change the openfire source code and print it) **

** the packet is a fully correct packet.but client didn’t paser it correct. i think may be **

two reason cause:

**
**

** 1 smack parse have some bug **

**
**

** 2 too many message push to client , the client parse the byte to char not correctly (decode incorrectly)
**

**
**

** Any advice Welcome**

**
**

** Thanks**

This type of error is usually caused by a provider improperly reading a stanza, or elements of a stanza. If a provider doesn’t handle all cases properly when reading the stanza elements, it can easily either read past the end of a stanza or not read to the end of it.

This will leave the pull parser in an inconsistent state as the current pointer is no longer pointing at the beginning of the next stanza to be processed.

Are you parsing custom stanzas with a custom provider?

Hi rcollier:

i am using a custom provider, i will check it ,thank you!

Hi rcollier:

i modified the code, now I am using cunstom provider to parse my custom iq message and message ext, when I logined one user ,i can print all my custom iq xml and message ext xml from server, that’s indicated smack use my custom provider to parse the xml correctly. but when i use 50 users to test,the exception ocuur again

org.xmlpull.v1.XmlPullParserException: expected = after attribute name (position: END_TAG seen …35.110/Smack" to="test35@172.17.35.110"/><sence id=“TbRFw-335” f"… @1:1375413)

at org.xmlpull.mxp1.MXParser.parseAttribute(MXParser.java:2004)

at org.xmlpull.mxp1.MXParser.parseStartTag(MXParser.java:1799)

at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1259)

at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:368)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)

org.xmlpull.v1.XmlPullParserException: unexpected character in markup > (position: END_TAG seen …80" from="test4@172.17.35.110/Smack" to="test41@172.17.35.110"/><>… @1:1385318)

at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1261)

at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:368)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)

and find a error i haven’t found before

javax.net.ssl.SSLException: Received fatal alert: internal_error

at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190)

at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1694)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:939)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImp l.java:1120)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:11 47)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:11 31)

at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:12 58)

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:313)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)

Exception in thread “Smack Reconnection Manager” java.lang.IllegalStateException: Not connected to server.

at org.jivesoftware.smack.XMPPConnection.sendPacket(XMPPConnection.java:729)

at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication .java:70)

at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 345)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:395)

at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1426)

at org.jivesoftware.smack.ReconnectionManager$2.run(ReconnectionManager.java:123)

my purpose is to test my plugin pressure ,any other method can finish it ? thank you !!

I recommend you code against the latest code from the 3_2 branch and use the EmbeddedExtensionProvider. It takes care of the element parsing for you thus lessening the chance of messing up the start tags.

Note that there are two, the one in smackx is deprecated.