Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intermittent Connection Reset by Peer errors in Android connecting to .NET REST endpoint

I'm getting intermittent errors from devices connecting to my IIS REST service via SSL. My app works just fine, but sometimes I get this exception. It is handled properly and does not bring down app..

ut I wonder what does it mean and if there any way to fix it? Currently it causes delays in data retreived. Also, it floods logs and I can't really ignore it.. I wonder if I can better this situation.

Is this something I should expect when I deal with REST services? My server is on Amazon EC2.

Read error: ssl=0x1211a88: I/O error during system call, Connection reset by peer

javax.net.ssl.SSLException: Read error: ssl=0x1211a88: I/O error during system call, Connection reset by peer at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_read(Native Method) at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:671) at libcore.io.Streams.readSingleByte(Streams.java:41) at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:655) at libcore.io.Streams.readAsciiLine(Streams.java:201) at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:544) at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:784) at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274) at libcore.net.http.HttpURLConnectionImpl.getResponseMessage(HttpURLConnectionImpl.java:475) at libcore.net.http.HttpsURLConnectionImpl.getResponseMessage

This is NOT something I can reproduce. Not permissions or onaything like this. This is intermittent problem. I see about 1000 of those every day from 200 devices connecting every minute.

like image 424
katit Avatar asked Jun 13 '12 18:06

katit


People also ask

Why is connection reset by peer?

The error message "Connection reset by peer" appears, if the web services client was waiting for a SOAP response from the remote web services provider and the connection was closed prematurely. One of the most common causes for this error is a firewall in the middle closing the connection.

What is IOException Connection reset by peer?

java.io.IOException: Connection reset by peer. The other side has abruptly aborted the connection in midst of a transaction. That can have many causes which are not controllable from the server side on.


1 Answers

It seems like a timeout issue occurring on the client side causing for this exception on your server side. I've seen this happening on an upload method I have on my service, since it takes sometime to upload the file the chances the mobile will move between networks are quite high and that might cause this issue.

I would examine the following solutions:

  1. Try and figure if its a certain mobile device manufacturer that causes your logs to flood with those exceptions. I've experienced cases where the manufacturer network handling was behaving differently from other brands. In case you do find that there is a specific brand causing this you might extend the default timeout on that specific device or further investigate and try to reproduce on that device.
  2. I would also examine if the clients causing those exceptions are timed out because of a latency issue for that specific called method. maybe certain customers are experiencing a certain performance issue while calling a certain method. If it is a performance issue you probably going to fix it on the server side and there is no use of investigating the client side.

Please update if you have any further details.

like image 175
liorsolomon Avatar answered Nov 14 '22 22:11

liorsolomon