Hystrix 命令失败并显示“超时并且没有可用的后备”

2024-03-06

我注意到我的应用程序中的某些命令失败了

Caused by: ! com.netflix.hystrix.exception.HystrixRuntimeException: GetAPICommand timed-out and no fallback available.
out: ! at com.netflix.hystrix.HystrixCommand.getFallbackOrThrowException(HystrixCommand.java:1631)
out: ! at com.netflix.hystrix.HystrixCommand.access$2000(HystrixCommand.java:97)
out: ! at com.netflix.hystrix.HystrixCommand$TimeoutObservable$1$1.tick(HystrixCommand.java:1025)
out: ! at com.netflix.hystrix.HystrixCommand$1.performBlockingGetWithTimeout(HystrixCommand.java:621)
out: ! at com.netflix.hystrix.HystrixCommand$1.get(HystrixCommand.java:516)
out: ! at com.netflix.hystrix.HystrixCommand.execute(HystrixCommand.java:425)
out: Caused by: ! java.util.concurrent.TimeoutException: null
out: !... 11 common frames omitted

这是我的 Hystrix 配置覆盖:

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=210000
hystrix.threadpool.default.coreSize=50
hystrix.threadpool.default.maxQueueSize=100
hystrix.threadpool.default.queueSizeRejectionThreshold=50

这是什么样的超时?是否是外部应用程序的读取/连接超时?我该如何调试这个?


这是一个 Hystrix 命令超时,默认情况下每个命令都会启用此超时,您可以使用以下属性定义该值:

execution.isolation.thread.timeoutInMilliseconds:此属性设置以毫秒为单位的时间,之后调用者将 观察超时并退出命令执行。 Hystrix 将 > HystrixCommand 标记为 TIMEOUT,并执行回退逻辑。

因此,您可以使用以下属性增加命令的超时值或禁用默认超时(如果适用于您的情况):

@HystrixProperty(name = "hystrix.command.default.execution.timeout.enabled", value = "false")

您可以在这里找到更多信息:https://github.com/Netflix/Hystrix/wiki/Configuration#CommandExecution https://github.com/Netflix/Hystrix/wiki/Configuration#CommandExecution

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Hystrix 命令失败并显示“超时并且没有可用的后备” 的相关文章

随机推荐