解决SpringCloud之Feign超时问题(Read timed out executing POST http://***)
Question:
在调用外部接口时可能会由于延迟,造成造成Feign “Read timed out executing POST”
feign.RetryableException: Read timed out executing POST http://******at feign.FeignException.errorExecuting(FeignException.java:67)at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:104)at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76)at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103)at com.sun.proxy.$Proxy113.getBaseRow(Unknown Source)
Caused by: java.net.SocketTimeoutException: Read timed outat java.net.SocketInputStream.socketRead0(Native Method)at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)at java.net.SocketInputStream.read(SocketInputStream.java:170)at java.net.SocketInputStream.read(SocketInputStream.java:141)at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)at java.io.BufferedInputStream.read(BufferedInputStream.java:345)at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:704)at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1569)at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)at feign.Client$Default.convertResponse(Client.java:152)at feign.Client$Default.execute(Client.java:74)
solution:
Feign接口调用分两层,Ribbon的调用和Hystrix调用,理论上设置Ribbon的时间即可,但是Ribbon的超时时间和Hystrix的超时时间需要结合起来,按照木桶原则最低的就是Feign的超时时间,建议最好配置超时时间一致。经过配置一下application设置后,完美解决了问题。因为第三方接口中需要3~20秒不等的时间,所以这个数值也是根据自己的业务系统情况设置的。
application.xml:
#hystrix的超时时间
hystrix:command:default:execution:timeout:enabled: trueisolation:thread:timeoutInMilliseconds: 30000
#ribbon的超时时间
ribbon:ReadTimeout: 30000ConnectTimeout: 30000
解决SpringCloud之Feign超时问题(Read timed out executing POST http://***)相关推荐
- springcloud之Feign超时问题(Read timed out executing POST http://***)
问题背景 最近公司项目有个功能需进行三层Feign调用,且还要调外部接口,延迟挺大,造成Feign一直提示Read timed out executing POST. feign.RetryableE ...
- 解决redis远程连接超时:Connection timed out
今天在项目中连接远程redis时,抛出连接超时异常:connect timed out. 详细信息例如以下: org.springframework.data.redis.connection.Poo ...
- feign.RetryableException: Read timed out executing 异常解决办法
首先看一下报错整体: feign.RetryableException: Read timed out executing GET (你访问的地址)at feign.FeignException.er ...
- springcloud 实战 feign使用中遇到的相关问题
springcloud 实战 feign使用中遇到的相关问题 1.使用feign客户端调用其他微服务时,session没有传递成功,sessionId不一样. /*** @author xbchenf ...
- feign.RetryableException: Read timed out executing POST http://......
问题描述 SpringCloud微服务之间远程调用报错超时. feign.RetryableException: Read timed out executing POST http://...... ...
- feign.RetryableException: connect timed out executing xxxxxx
Spring Cloud 使用 OpenFeign 报错 connect timed out executing GET http://CLOUD-PAYMENT-SERVICE/payment/fe ...
- 微服务调用异常:error feign.RetryableException: Read timed out executing POST http://xxx.......
最近在将nacos server版本从1.3版本升级到1.4版本,接口服务调用基础的搜索服务时出现以上异常.因为是时而正常,时而超时,推测是注册客户端的版本过低,于是升级Nacos client版本, ...
- Spring could 使用Feign超时问题
2019独角兽企业重金招聘Python工程师标准>>> 在使用Spring Cloud的时候遇见了 这个异常: feign.RetryableException: Read time ...
- python无法安装第三方库read time out_解决pip install的时候报错timed out的问题
安装包的时候报错,执行:pip install pyinstaller 问题: File "c:\python\python35\lib\site-packages\pip\_vendor\ ...
最新文章
- 计算机组成原理名词解释常用,2018考研408计算机组成原理名词解释(3)
- Mybatis-入门
- mysql 衍生表必须有别名_MySQL“每个派生表必须有自己的别名”
- 设置XenServer中的Linux vm从光驱启动
- Vivado提高综合和实现的速度
- 第一百二十九期:阿里内部员工,排查Java问题常用的工具单
- 2014-4-2学习笔记(Linux从入门到精通 刘忆智 清华大学出版社)
- CSS和JS两种颜色渐变文字效果代码
- python线程的学习
- Python string字符串
- zabbix 3.0快速安装简介(centos 6)
- oracle 触发器 实例
- AIR202的lua开发
- IntelliJ IDEA如何创建Source Folder和导入jar包
- Ubuntu 安装 OpenFOAM + PETSc
- 移动端meta设置大全(持续收集中。。。。)
- python数据处理系列之读写csv数据
- 《C++ Primer》第15章 15.2节习题答案
- android6.0 Bluetooth蓝牙源码流程笔记
- 图的邻接矩阵存储及遍历
热门文章
- 智慧教室系统服务器参数,台湾智慧教室整体解决方案_服务器产业-中关村在线...
- 极简设计模式 - 装饰者模式
- “音乐剧教父”韦伯最新力作《摇滚学校》将首次来华演出
- 英语知识点整理day22-谚语学习(M字母开头)
- ChinaJoy09一行
- 5G与LTE双连接技术架构的选择分析
- 基于51单片机的温湿度测量电力载波通信(实物+原理图+PCB+全套资料)
- 台式机进入BIOS后黑屏
- Low-resource Neural Machine Translation
- php批量爬取上市公司高管持股变动信息