昨天突然有很多接口获取失败,通过 kibana发现大量异常,具体异常信息:
...into fallback. Rejected command because thread-pool queueSize is at rejection threshold.
异常代码出处:
@FeignClient(name = "api", fallbackFactory = LoadBalancingFallbackFactory.class)
public interface LoadBalancingFeignClient {
@PostMapping(value = "/api/loadBalancing/server")
Result currentServer();
}
@Slf4j
@Component
public class LoadBalancingFallbackFactory implements FallbackFactory<LoadBalancingFeignClient> {
@Override
public LoadBalancingFeignClient create(Throwable throwable) {
final String msg = throwable.getMessage();
return () -> {
log.error("loadBalancingFeignClient currentServer into fallback. {}", msg);
return Result.error();
};****
}
}
原因:
看到这里已经很明显了,是由于hystrix线程池不够用,直接熔断导致的。