java - Hystrix 命令失败并显示 "timed-out and no fallback available"

标签 java java.util.concurrent hystrix

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

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: This property sets the time in milliseconds after which the caller will observe a timeout and walk away from the command execution. Hystrix marks > the HystrixCommand as a TIMEOUT, and performs fallback logic.

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

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

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

关于java - Hystrix 命令失败并显示 "timed-out and no fallback available",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27375557/

相关文章:

java - ForkJoinPool 在 invokeAll/join 期间停止

java - 通过并发增加磁盘读取吞吐量

java - Mockito:如何使服务调用抛出异常

spring - javanica @HystrixCommand 和 spring @Cacheable 执行顺序

java - 如何使用 Java 创建 .dst 刺绣文件

Java Jsoup : Retrieve only the article

java - 如何使用 CyclingBarrier 同步线程并保留其执行顺序?

java - 顺序 JDBC 语句执行不进行事务处理

java - Gradle 构建失败 - APK META-INF 中复制的重复文件

spring-cloud - Spring Cloud config feign fallback(CircuitBreaker) 规则