生产服务器上遇到:
平时服务器并没有报这个错,因为最近修了几个BUG增加了几个功能导致频繁出现问题

org.apache.http.conn.ConnectTimeoutException: Connect to xxxx.com:443 [xxx.com/111.13.xxx.xxx] failed: connect timed out
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)\n\tat 
org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:374)\n\tat 
org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)\n\tat 
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)\n\tat 
org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)\n\tat 
org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)\n\tat 
org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)\n\tat 
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)\n\tat 
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)\n\tat 
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)\n\tat 

排查思路:

  1. 是否是httpclient线程池设置问题 --无效
  2. 调整超时时间 --无效,因为已经设置为5000ms了
  3. 咨询供应商 -- 供应商并发和丢包都在合理范围内
  4. 切换网络 --无效,并没有解决
  5. 修改linux内核tcp参数 --成功

核心原因是:net.ipv4.tcp_timestamps 应该设置成0
https://zhuanlan.zhihu.com/p/145939529
https://zhuanlan.zhihu.com/p/30072105


nohup
160 声望9 粉丝