powered by Jive Software

connectionClosedOnError when sending message

Hi evreyone,

I have this strange error : connectionClosedOnError - Read error: ssl=0x98dcaa00: I/O error during system call, Connection reset by peer.
This is happening only when i try to send a message with a very long string attachment (thumbnail of an image) with more or less 8300 chars in a base64 representation.

In the android console i can read this shutdownDone was not marked as successful by the writer thread with the following Logcat

Logcat
W/XMPPTCPConnection: shutdownDone was not marked as successful by the writer thread
org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 30000ms (~30s). Used filter: No filter used or filter was ‘null’.
at org.jivesoftware.smack.SynchronizationPoint.checkForResponse(SynchronizationPoint.java:253)
at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWait(SynchronizationPoint.java:146)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.shutdown(XMPPTCPConnection.java:1291)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.shutdown(XMPPTCPConnection.java:506)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.instantShutdown(XMPPTCPConnection.java:495)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.notifyConnectionError(XMPPTCPConnection.java:891)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$2800(XMPPTCPConnection.java:139)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.writePackets(XMPPTCPConnection.java:1441)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.access$2900(XMPPTCPConnection.java:1192)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter$1.run(XMPPTCPConnection.java:1240)
at java.lang.Thread.run(Thread.java:761)
W/AbstractXMPPConnection: Connection closed with error
javax.net.ssl.SSLException: Write error: ssl=0x8ccaca80: I/O error during system call, Connection reset by peer
at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_write(Native Method)
at com.google.android.gms.org.conscrypt.SslWrapper.write(:com.google.android.gms@11746470)
at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket$SSLOutputStream.write(:com.google.android.gms@11746470:6)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at org.jivesoftware.smack.util.ObservableWriter.flush(ObservableWriter.java:46)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.writePackets(XMPPTCPConnection.java:1392)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.access$2900(XMPPTCPConnection.java:1192)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter$1.run(XMPPTCPConnection.java:1240)
at java.lang.Thread.run(Thread.java:761)

Since i have enabled
XMPPTCPConnection.setUseStreamManagementDefault(true);
XMPPTCPConnection.setUseStreamManagementResumptionDefault(true); in my connection setup sometimes this produces also StreamManagementException$StreamManagementCounterError with the following logcat

Logcat
Connection closed with error
org.jivesoftware.smack.sm.StreamManagementException$StreamManagementCounterError: There was an error regarding the Stream Mangement counters. Server reported 22 handled stanzas, which means that the 5 recently send stanzas by client are now acked by the server. But Smack had only 1 to acknowledge. The stanza id of the last acked outstanding stanza is 1Lb8P-52
at org.jivesoftware.smack.tcp.XMPPTCPConnection.processHandledCount(XMPPTCPConnection.java:1780)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$2400(XMPPTCPConnection.java:139)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1133)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:956)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:971)
at java.lang.Thread.run(Thread.java:818)

making the app unable to reconnect automatically since its giving me this StreamManagementCounterError error again and again.

Currently I’m ussing version 4.1.9 with ejabberd on the backend side.

Is there any maximum length on the message size that i didn’t read anywhere? Or am I doing wrong somewhere else?

Thanks in advance

That does look like the server is terminating the connection. I suggest looking at the server logs for hints.