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

孤街浪徒 提交于 2019-12-29 05:25:54

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/11021551/intermittent-connection-reset-by-peer-errors-in-android-connecting-to-net-rest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!