java.net.ConnectException:连接失败,isConnected失败:ECONNABORTED。发生这种情况时,后续请求将是错误的

时间:2019-07-03 06:25:55

标签: android okhttp3

我遇到了很多这样的问题。发生这种情况时,后续请求将是错误的。重新启动应用程序不能解决问题,但是重新启动网络可以解决。终端上有2%的机会出现它。

日志:

java.net.ConnectException: Failed to connect to app.shubl.com/101.37.31.235:80
at okhttp3.internal.connection.RealConnection.connectSocket(Unknown Source:145)
at okhttp3.internal.connection.RealConnection.connect(Unknown Source:190)
at okhttp3.internal.connection.StreamAllocation.findConnection(Unknown Source:264)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(Unknown Source:0)
at okhttp3.internal.connection.StreamAllocation.newStream(Unknown Source:22)
at okhttp3.internal.connection.ConnectInterceptor.intercept(Unknown Source:25)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:161)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:6)
at okhttp3.internal.cache.CacheInterceptor.intercept(Unknown Source:136)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:161)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:6)
at okhttp3.internal.http.BridgeInterceptor.intercept(Unknown Source:173)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:161)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(Unknown Source:59)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:161)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:6)
at okhttp3.RealCall.getResponseWithInterceptorChain(Unknown Source:115)
at okhttp3.RealCall$AsyncCall.execute(Unknown Source:10)
at okhttp3.internal.NamedRunnable.run(Unknown Source:17)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.net.ConnectException: failed to connect to app.shubl.com/101.37.31.235 (port 80) from /10.211.37.210 (port 38281) after 60000ms: isConnected failed: ECONNABORTED (Software caused connection abort)
at libcore.io.IoBridge.isConnected(IoBridge.java:273)
at libcore.io.IoBridge.connectErrno(IoBridge.java:188)
at libcore.io.IoBridge.connect(IoBridge.java:130)
at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:129)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:356)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:357)
at java.net.Socket.connect(Socket.java:616)
at okhttp3.internal.platform.AndroidPlatform.connectSocket(Unknown Source:0)
at okhttp3.internal.connection.RealConnection.connectSocket(Unknown Source:71)
... 21 more
Caused by: android.system.ErrnoException: isConnected failed: ECONNABORTED (Software caused connection abort)
at libcore.io.IoBridge.isConnected(IoBridge.java:262)
... 31 more

1 个答案:

答案 0 :(得分:0)

https://stackoverflow.com/a/28167152/9195139

该错误称为端口AND,此IP地址上的错误尚未准备好接收。可能的解释是:

  • 服务已崩溃或尚未启动,
  • 您的客户端正在尝试使用错误的IP地址或端口进行连接,或者
  • 服务器访问已被代表服务器/服务“拒绝”的防火墙阻止。鉴于通常的做法(这些天来)是让防火墙“黑洞”所有不需要的连接尝试,所以这种可能性很小。