现象描述:
springboot 代码中 请求一个http 服务,测试环境和本地host都没问题,但是生产环境上就报超时问题,
一开始方向性错误以为是 resttemplate的问题,百度一顿操作,改成httpclient,然卵,
重新回退代码,上生产服务器直接curl http请求发现 第一次成功,然后超时隔一段时间又成功如何分析拆解
代码错误异常
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://xxx: Connect to xxx [/xxx] failed: connect timed out; nested exception is org.apache.http.conn.ConnectTimeoutException: Connect to 6xxx [/] failed: connect timed out at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:748)
百度一堆解决方法,都没解决。
拜访运维大佬,开发大佬,
发现在别的生产服务器 可以顺滑调用,丝滑的不得了。
找运维抓包,curl了N次
发现返回 对方没有返回数据 0字节
扫描二维码关注公众号,回复:
12291790 查看本文章
最后运维比对两个服务器的回包地址发现不一样。
改了一下,ok了
活好话不多,有幸来关注