1

I have a strange situation. about 50% of my requests failed with this exception.

11-22 19:46:55.352: W/System.err(15987): java.net.SocketTimeoutException: Connection timed out
11-22 19:46:55.362: W/System.err(15987):    at org.apache.harmony.luni.platform.OSNetworkSystem.connect(Native Method)
11-22 19:46:55.372: W/System.err(15987):    at dalvik.system.BlockGuard$WrappedNetworkSystem.connect(BlockGuard.java:357)
11-22 19:46:55.372: W/System.err(15987):    at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:207)
11-22 19:46:55.382: W/System.err(15987):    at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:440)
11-22 19:46:55.392: W/System.err(15987):    at java.net.Socket.connect(Socket.java:1013)
11-22 19:46:55.402: W/System.err(15987):    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:75)
11-22 19:46:55.402: W/System.err(15987):    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:48)
11-22 19:46:55.482: W/System.err(15987):    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:322)
11-22 19:46:55.482: W/System.err(15987):    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:89)
11-22 19:46:55.482: W/System.err(15987):    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:285)
11-22 19:46:55.502: W/System.err(15987):    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:267)
11-22 19:46:55.502: W/System.err(15987):    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:205)
11-22 19:46:55.512: W/System.err(15987):    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:614)
11-22 19:46:55.512: W/System.err(15987):    at ***.net.BasePostMethod.sendRequest(BasePostMethod.java:56)

At this line:

connection.getOutputStream();

My timeouts:

connection.setReadTimeout(20000);
connection.setConnectTimeout(20000);

I use HttpURLConnection.

4

0 回答 0