AnsweredAssumed Answered

Reasons for connectionClosedOnError() smackException

Question asked by Sandeep Shinde on Mar 1, 2016
Latest reply on Jul 21, 2016 by Tony

Hello everyone,

 

We have developed one chatting application. It works fine on stable network without any issue, but whenever network fluctuation there is continues loss of connectivity between app and server. Many a times connectionClosedOnError() gets called with following Exceptions which changes all the time.

 

1.) This is also one exception in connectionClosedOnError() when there is loss in connection or fluctuation in wifi connection.

 

s W/System.err: java.io.EOFException

03-01 12:33:09.311 31636-31723/com.app.radius W/System.err:     at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:169)

03-01 12:33:09.311 31636-31723/com.app.radius W/System.err:     at java.io.InputStreamReader.read(InputStreamReader.java:233)

03-01 12:33:09.311 31636-31723/com.app.radius W/System.err:     at java.io.BufferedReader.read(BufferedReader.java:325)

03-01 12:33:09.311 31636-31723/com.app.radius W/System.err:     at org.jivesoftware.smack.util.ObservableReader.read(ObservableReader.java:41)

03-01 12:33:09.311 31636-31723/com.app.radius W/System.err:     at org.kxml2.io.KXmlParser.fillBuffer(KXmlParser.java:1515)

03-01 12:33:09.311 31636-31723/com.app.radius W/System.err:     at org.kxml2.io.KXmlParser.peekType(KXmlParser.java:992)

03-01 12:33:09.311 31636-31723/com.app.radius W/System.err:     at org.kxml2.io.KXmlParser.next(KXmlParser.java:349)

03-01 12:33:09.312 31636-31723/com.app.radius W/System.err:     at org.kxml2.io.KXmlParser.next(KXmlParser.java:313)

03-01 12:33:09.312 31636-31723/com.app.radius W/System.err:     at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:1169)

03-01 12:33:09.312 31636-31723/com.app.radius W/System.err:     at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPCon nection.java:948)

03-01 12:33:09.312 31636-31723/com.app.radius W/System.err:     at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:963)

03-01 12:33:09.312 31636-31723/com.app.radius W/System.err:     at java.lang.Thread.run(Thread.java:818).

 

2.) This is the exceptions raised while switching the data wifi network.

 

com.e0.chat D/SMACK﹕ XMPPConnection closed    due to an exception (0) 

04-28 10:18:35.237    1221-1276/com.e0.chat W/System.err﹕ java.net.SocketException: recvfrom failed: ETIMEDOUT (Connection timed out) 

04-28 10:18:35.237    1221-1276/com.e0.chat W/System.err﹕ at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:592) 

04-28 10:18:35.237    1221-1276/com.e0.chat W/System.err﹕ at libcore.io.IoBridge.recvfrom(IoBridge.java:556) 

04-28 10:18:35.237    1221-1276/com.e0.chat W/System.err﹕ at java.net.PlainSocketImpl.read(PlainSocketImpl.java:485) 

04-28 10:18:35.237    1221-1276/com.e0.chat W/System.err﹕ at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37) 

04-28 10:18:35.237    1221-1276/com.e0.chat W/System.err﹕ at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237) 

04-28 10:18:35.237    1221-1276/com.e0.chat W/System.err﹕ at java.io.InputStreamReader.read(InputStreamReader.java:231) 

04-28 10:18:35.237    1221-1276/com.e0.chat W/System.err﹕ at java.io.BufferedReader.read(BufferedReader.java:325) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ at org.jivesoftware.smack.util.ObservableReader.read(ObservableReader.java:41) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ at org.kxml2.io.KXmlParser.fillBuffer(KXmlParser.java:1515) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ at org.kxml2.io.KXmlParser.peekType(KXmlParser.java:992) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ at org.kxml2.io.KXmlParser.next(KXmlParser.java:349) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ at org.kxml2.io.KXmlParser.next(KXmlParser.java:313) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:1151) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPCon nection.java:937) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:952) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ at java.lang.Thread.run(Thread.java:818) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ Caused by: android.system.ErrnoException: recvfrom failed: ETIMEDOUT (Connection timed out) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ at libcore.io.Posix.recvfromBytes(Native Method) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ at libcore.io.Posix.recvfrom(Posix.java:161) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:250) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ at libcore.io.IoBridge.recvfrom(IoBridge.java:553) 

04-28 10:18:35.242    1221-1276/com.e0.chat W/System.err﹕ ... 14 more.

Outcomes