RetryableException: Read timed out executing导致服务假死无响应
最近发现Plan这个微服务经常会无响应,后来发现是task微服务会调用plan的某个接口,经常报错如下异常,然后time out后又30秒再次发起重试而这个业务处理时间1分钟-2小时都有可能
所以把plan微服务线程池占满导致无响应
2024-05-13 14:27:00.282 N/A,b1f2a3468b14468abef240bfeddd8b95,0 [pool-16-thread-5] ERROR c.h.n.c.t.t.TcFileProcessScheduleSendPlanFromOdmToHpJob.fileProcessCronSendPlanFromOdmToHpJob [206] :
feign.RetryableException: Read timed out executing POST http://NOVAPLANSERV/api/v1/plans/syncPlanToOdm
at feign.FeignException.errorExecuting(FeignException.java:277)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:110)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:70)
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:96)
at jdk.proxy2/jdk.proxy2.$Proxy163.syncPlanToOdm(Unknown Source)
解决方法:
网上查了很多,试了如下配置都无效
feign:
client:
config:
default:
connectTimeout: 60000
readTimeout: 60000
#hystrix的超时时间
hystrix:
command:
default:
execution:
timeout:
enabled: true
isolation:
thread:
timeoutInMilliseconds: 30000
feign.hystrix.enabled: true
hystrix 熔断机制
hystrix:
shareSecurityContext: true
command:
default:
circuitBreaker:
sleepWindowInMilliseconds: 100000
forceClosed: true
execution:
isolation:
thread:
timeoutInMilliseconds: 600000
#ribbon的超时时间
ribbon:
ReadTimeout: 30000
ConnectTimeout: 30000
后来发现因为我们升级到了最新的springboot
然后使用了最新的openfeign
Spring Cloud OpenFeign 中文文档 (springdoc.cn)
所以应该如下配置:
spring:
cloud:
openfeign:
client:
config:
default:
connectTimeout: 20000000
readTimeout: 20000000
loggerLevel: basic