Spring Cloud Sidecar 负载平衡不会在失败时重试
Spring Cloud Sidecar load balancing does not retry on failure
我有以下设置:
- Spring Cloud Eureka Server(Spring 使用
@EnableEurekaServer
启动应用程序)
- Spring Cloud Sidecar(运行 在
:8080
上)
- 2 个相同 Spring 引导应用程序的实例正确注册了 Eureka (
@EnableEurekaClient
) 并公开了单个 GET /configurations
端点(运行 在 :8081
和 :8082
)
所有这些 运行 在 Java 8 + Spring Cloud 1.1.0.M5 上。
在 :8080
上通过 Sidecar 调用 REST 端点工作正常,请求负载平衡正确,客户端响应正确。如果我关闭 2 个应用程序实例之一并再次调用端点,客户端会收到此错误:
{
"timestamp": 1458328852272,
"status": 500,
"error": "Internal Server Error",
"exception": "com.netflix.zuul.exception.ZuulException",
"message": "Forwarding error"
}
Sidecar 日志显示如下:
[2m2016-03-18 15:20:50.201[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.zuul.http.HttpServletRequestWrapper [0;39m [2m:[0;39m Path = null
[2m2016-03-18 15:20:50.201[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.zuul.http.HttpServletRequestWrapper [0;39m [2m:[0;39m Transfer-Encoding = null
[2m2016-03-18 15:20:50.201[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.zuul.http.HttpServletRequestWrapper [0;39m [2m:[0;39m Content-Encoding = null
[2m2016-03-18 15:20:50.201[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.zuul.http.HttpServletRequestWrapper [0;39m [2m:[0;39m Content-Length header = -1
[2m2016-03-18 15:20:50.209[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.loadbalancer.ZoneAwareLoadBalancer [0;39m [2m:[0;39m Zone aware logic disabled or there is only one zone
[2m2016-03-18 15:20:50.209[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.loadbalancer.LoadBalancerContext [0;39m [2m:[0;39m blue-config using LB returned Server: localhost:blue-config:6ef471326fe62d8877b94e2a8be06058 for request /configurations
[2m2016-03-18 15:20:50.211[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.niws.client.http.RestClient [0;39m [2m:[0;39m RestClient sending new Request(GET: ) http://localhost:8082/configurations
[2m2016-03-18 15:20:50.211[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.http4.MonitoredConnectionManager [0;39m [2m:[0;39m Get connection: {}->http://localhost:8082, timeout = 2000
[2m2016-03-18 15:20:50.211[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m [{}->http://localhost:8082] total kept alive: 2, total issued: 0, total allocated: 2 out of 200
[2m2016-03-18 15:20:50.211[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m Getting free connection [{}->http://localhost:8082][null]
[2m2016-03-18 15:20:50.212[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NFHttpClient [0;39m [2m:[0;39m Stale connection check
[2m2016-03-18 15:20:50.212[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NFHttpClient [0;39m [2m:[0;39m Stale connection detected
[2m2016-03-18 15:20:51.240[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[ HystrixTimer-3][0;39m [36mcom.netflix.hystrix.AbstractCommand [0;39m [2m:[0;39m No fallback for HystrixCommand.
java.lang.UnsupportedOperationException: No fallback available.
at com.netflix.hystrix.HystrixCommand.getFallback(HystrixCommand.java:284) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.HystrixCommand.call(HystrixCommand.java:311) [hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.HystrixCommand.call(HystrixCommand.java:306) [hystrix-core-1.4.23.jar:1.4.23]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.unsafeSubscribe(Observable.java:7710) [rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorOnErrorResumeNextViaFunction.onError(OperatorOnErrorResumeNextViaFunction.java:100) [rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorDoOnEach.onError(OperatorDoOnEach.java:70) [rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorDoOnEach.onError(OperatorDoOnEach.java:70) [rxjava-1.0.14.jar:1.0.14]
at com.netflix.hystrix.AbstractCommand$HystrixObservableTimeoutOperator.run(AbstractCommand.java:958) [hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable.call(HystrixContextRunnable.java:41) [hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable.call(HystrixContextRunnable.java:37) [hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable.run(HystrixContextRunnable.java:57) [hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.AbstractCommand$HystrixObservableTimeoutOperator.tick(AbstractCommand.java:978) [hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.util.HystrixTimer.run(HystrixTimer.java:100) [hystrix-core-1.4.23.jar:1.4.23]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.FutureTask.runAndReset(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access1(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_74]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_74]
[2m2016-03-18 15:20:52.216[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.http4.MonitoredConnectionManager [0;39m [2m:[0;39m Released connection is not reusable.
[2m2016-03-18 15:20:52.216[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m Releasing connection [{}->http://localhost:8082][null]
[2m2016-03-18 15:20:52.217[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m Notifying no-one, there are no waiting threads
[2m2016-03-18 15:20:52.218[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.l.reactive.LoadBalancerCommand [0;39m [2m:[0;39m Got error com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect when executed on server localhost:blue-config:6ef471326fe62d8877b94e2a8be06058
[2m2016-03-18 15:20:52.220[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.loadbalancer.ZoneAwareLoadBalancer [0;39m [2m:[0;39m Zone aware logic disabled or there is only one zone
[2m2016-03-18 15:20:52.220[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.loadbalancer.LoadBalancerContext [0;39m [2m:[0;39m blue-config using LB returned Server: localhost:blue-config:7ffe630c9c6f6acf456faba18058bf55 for request /configurations
[2m2016-03-18 15:20:52.221[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.niws.client.http.RestClient [0;39m [2m:[0;39m RestClient sending new Request(GET: ) http://localhost:8081/configurations
[2m2016-03-18 15:20:52.221[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.http4.MonitoredConnectionManager [0;39m [2m:[0;39m Get connection: {}->http://localhost:8081, timeout = 2000
[2m2016-03-18 15:20:52.221[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m [{}->http://localhost:8081] total kept alive: 1, total issued: 0, total allocated: 1 out of 200
[2m2016-03-18 15:20:52.221[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m Getting free connection [{}->http://localhost:8081][null]
[2m2016-03-18 15:20:52.221[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NFHttpClient [0;39m [2m:[0;39m Stale connection check
[2m2016-03-18 15:20:52.223[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NFHttpClient [0;39m [2m:[0;39m Attempt 1 to execute request
[2m2016-03-18 15:20:52.239[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NFHttpClient [0;39m [2m:[0;39m Connection can be kept alive indefinitely
[2m2016-03-18 15:20:52.240[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.http4.MonitoredConnectionManager [0;39m [2m:[0;39m Released connection is reusable.
[2m2016-03-18 15:20:52.240[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m Releasing connection [{}->http://localhost:8081][null]
[2m2016-03-18 15:20:52.240[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m Pooling connection [{}->http://localhost:8081][null]; keep alive indefinitely
[2m2016-03-18 15:20:52.240[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m Notifying no-one, there are no waiting threads
[2m2016-03-18 15:20:52.243[0;39m [33m WARN[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mo.s.c.n.z.filters.post.SendErrorFilter [0;39m [2m:[0;39m Error during filtering
com.netflix.zuul.exception.ZuulException: Forwarding error
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:134) ~[spring-cloud-netflix-core-1.1.0.M5.jar:1.1.0.M5]
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:76) ~[spring-cloud-netflix-core-1.1.0.M5.jar:1.1.0.M5]
at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:112) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:197) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.FilterProcessor.runFilters(FilterProcessor.java:161) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.FilterProcessor.route(FilterProcessor.java:120) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.ZuulRunner.route(ZuulRunner.java:96) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.http.ZuulServlet.route(ZuulServlet.java:116) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.http.ZuulServlet.service(ZuulServlet.java:81) ~[zuul-core-1.1.0.jar:1.1.0]
at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:158) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.cloud.netflix.zuul.web.ZuulController.handleRequestInternal(ZuulController.java:43) [spring-cloud-netflix-core-1.1.0.M5.jar:1.1.0.M5]
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:147) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:860) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:237) [spring-boot-actuator-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:112) [spring-boot-actuator-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:103) [spring-boot-actuator-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) [tomcat-embed-core-8.0.32.jar:8.0.32]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_74]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.32.jar:8.0.32]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_74]
Caused by: com.netflix.hystrix.exception.HystrixRuntimeException: blue-config timed-out and no fallback available.
at com.netflix.hystrix.AbstractCommand.call(AbstractCommand.java:806) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.AbstractCommand.call(AbstractCommand.java:790) ~[hystrix-core-1.4.23.jar:1.4.23]
at rx.internal.operators.OperatorOnErrorResumeNextViaFunction.onError(OperatorOnErrorResumeNextViaFunction.java:99) ~[rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorDoOnEach.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorDoOnEach.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorDoOnEach.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.14.jar:1.0.14]
at com.netflix.hystrix.AbstractCommand$DeprecatedOnFallbackHookApplication.onError(AbstractCommand.java:1521) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.AbstractCommand$FallbackHookApplication.onError(AbstractCommand.java:1411) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.HystrixCommand.call(HystrixCommand.java:314) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.HystrixCommand.call(HystrixCommand.java:306) ~[hystrix-core-1.4.23.jar:1.4.23]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.unsafeSubscribe(Observable.java:7710) ~[rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorOnErrorResumeNextViaFunction.onError(OperatorOnErrorResumeNextViaFunction.java:100) ~[rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorDoOnEach.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorDoOnEach.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.14.jar:1.0.14]
at com.netflix.hystrix.AbstractCommand$HystrixObservableTimeoutOperator.run(AbstractCommand.java:958) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable.call(HystrixContextRunnable.java:41) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable.call(HystrixContextRunnable.java:37) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable.run(HystrixContextRunnable.java:57) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.AbstractCommand$HystrixObservableTimeoutOperator.tick(AbstractCommand.java:978) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.util.HystrixTimer.run(HystrixTimer.java:100) ~[hystrix-core-1.4.23.jar:1.4.23]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[na:1.8.0_74]
at java.util.concurrent.FutureTask.runAndReset(Unknown Source) ~[na:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access1(Unknown Source) ~[na:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[na:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_74]
... 1 common frames omitted
Caused by: java.util.concurrent.TimeoutException: null
at com.netflix.hystrix.AbstractCommand.call(AbstractCommand.java:601) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.AbstractCommand.call(AbstractCommand.java:581) ~[hystrix-core-1.4.23.jar:1.4.23]
at rx.internal.operators.OperatorOnErrorResumeNextViaFunction.onError(OperatorOnErrorResumeNextViaFunction.java:99) ~[rxjava-1.0.14.jar:1.0.14]
... 15 common frames omitted
有趣的是,似乎检测到了连接被拒绝的错误(Stale connection detected
)并且完成了对另一个实例的调用(我确实看到了传入的请求),但结果仍然是错误.我希望重试调用的响应返回给客户端。
这是一个里程碑错误还是我缺少一些配置才能使它正常工作?
原来超时的是 Hystrix。设置hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 5000
似乎可以解决问题。
谢谢斯宾塞!
我有以下设置:
- Spring Cloud Eureka Server(Spring 使用
@EnableEurekaServer
启动应用程序) - Spring Cloud Sidecar(运行 在
:8080
上) - 2 个相同 Spring 引导应用程序的实例正确注册了 Eureka (
@EnableEurekaClient
) 并公开了单个GET /configurations
端点(运行 在:8081
和:8082
)
所有这些 运行 在 Java 8 + Spring Cloud 1.1.0.M5 上。
在 :8080
上通过 Sidecar 调用 REST 端点工作正常,请求负载平衡正确,客户端响应正确。如果我关闭 2 个应用程序实例之一并再次调用端点,客户端会收到此错误:
{
"timestamp": 1458328852272,
"status": 500,
"error": "Internal Server Error",
"exception": "com.netflix.zuul.exception.ZuulException",
"message": "Forwarding error"
}
Sidecar 日志显示如下:
[2m2016-03-18 15:20:50.201[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.zuul.http.HttpServletRequestWrapper [0;39m [2m:[0;39m Path = null
[2m2016-03-18 15:20:50.201[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.zuul.http.HttpServletRequestWrapper [0;39m [2m:[0;39m Transfer-Encoding = null
[2m2016-03-18 15:20:50.201[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.zuul.http.HttpServletRequestWrapper [0;39m [2m:[0;39m Content-Encoding = null
[2m2016-03-18 15:20:50.201[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.zuul.http.HttpServletRequestWrapper [0;39m [2m:[0;39m Content-Length header = -1
[2m2016-03-18 15:20:50.209[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.loadbalancer.ZoneAwareLoadBalancer [0;39m [2m:[0;39m Zone aware logic disabled or there is only one zone
[2m2016-03-18 15:20:50.209[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.loadbalancer.LoadBalancerContext [0;39m [2m:[0;39m blue-config using LB returned Server: localhost:blue-config:6ef471326fe62d8877b94e2a8be06058 for request /configurations
[2m2016-03-18 15:20:50.211[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.niws.client.http.RestClient [0;39m [2m:[0;39m RestClient sending new Request(GET: ) http://localhost:8082/configurations
[2m2016-03-18 15:20:50.211[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.http4.MonitoredConnectionManager [0;39m [2m:[0;39m Get connection: {}->http://localhost:8082, timeout = 2000
[2m2016-03-18 15:20:50.211[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m [{}->http://localhost:8082] total kept alive: 2, total issued: 0, total allocated: 2 out of 200
[2m2016-03-18 15:20:50.211[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m Getting free connection [{}->http://localhost:8082][null]
[2m2016-03-18 15:20:50.212[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NFHttpClient [0;39m [2m:[0;39m Stale connection check
[2m2016-03-18 15:20:50.212[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NFHttpClient [0;39m [2m:[0;39m Stale connection detected
[2m2016-03-18 15:20:51.240[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[ HystrixTimer-3][0;39m [36mcom.netflix.hystrix.AbstractCommand [0;39m [2m:[0;39m No fallback for HystrixCommand.
java.lang.UnsupportedOperationException: No fallback available.
at com.netflix.hystrix.HystrixCommand.getFallback(HystrixCommand.java:284) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.HystrixCommand.call(HystrixCommand.java:311) [hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.HystrixCommand.call(HystrixCommand.java:306) [hystrix-core-1.4.23.jar:1.4.23]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) [rxjava-1.0.14.jar:1.0.14]
at rx.Observable.unsafeSubscribe(Observable.java:7710) [rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorOnErrorResumeNextViaFunction.onError(OperatorOnErrorResumeNextViaFunction.java:100) [rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorDoOnEach.onError(OperatorDoOnEach.java:70) [rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorDoOnEach.onError(OperatorDoOnEach.java:70) [rxjava-1.0.14.jar:1.0.14]
at com.netflix.hystrix.AbstractCommand$HystrixObservableTimeoutOperator.run(AbstractCommand.java:958) [hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable.call(HystrixContextRunnable.java:41) [hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable.call(HystrixContextRunnable.java:37) [hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable.run(HystrixContextRunnable.java:57) [hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.AbstractCommand$HystrixObservableTimeoutOperator.tick(AbstractCommand.java:978) [hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.util.HystrixTimer.run(HystrixTimer.java:100) [hystrix-core-1.4.23.jar:1.4.23]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.FutureTask.runAndReset(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access1(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_74]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_74]
[2m2016-03-18 15:20:52.216[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.http4.MonitoredConnectionManager [0;39m [2m:[0;39m Released connection is not reusable.
[2m2016-03-18 15:20:52.216[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m Releasing connection [{}->http://localhost:8082][null]
[2m2016-03-18 15:20:52.217[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m Notifying no-one, there are no waiting threads
[2m2016-03-18 15:20:52.218[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.l.reactive.LoadBalancerCommand [0;39m [2m:[0;39m Got error com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect when executed on server localhost:blue-config:6ef471326fe62d8877b94e2a8be06058
[2m2016-03-18 15:20:52.220[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.loadbalancer.ZoneAwareLoadBalancer [0;39m [2m:[0;39m Zone aware logic disabled or there is only one zone
[2m2016-03-18 15:20:52.220[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.loadbalancer.LoadBalancerContext [0;39m [2m:[0;39m blue-config using LB returned Server: localhost:blue-config:7ffe630c9c6f6acf456faba18058bf55 for request /configurations
[2m2016-03-18 15:20:52.221[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.niws.client.http.RestClient [0;39m [2m:[0;39m RestClient sending new Request(GET: ) http://localhost:8081/configurations
[2m2016-03-18 15:20:52.221[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.http4.MonitoredConnectionManager [0;39m [2m:[0;39m Get connection: {}->http://localhost:8081, timeout = 2000
[2m2016-03-18 15:20:52.221[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m [{}->http://localhost:8081] total kept alive: 1, total issued: 0, total allocated: 1 out of 200
[2m2016-03-18 15:20:52.221[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m Getting free connection [{}->http://localhost:8081][null]
[2m2016-03-18 15:20:52.221[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NFHttpClient [0;39m [2m:[0;39m Stale connection check
[2m2016-03-18 15:20:52.223[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NFHttpClient [0;39m [2m:[0;39m Attempt 1 to execute request
[2m2016-03-18 15:20:52.239[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NFHttpClient [0;39m [2m:[0;39m Connection can be kept alive indefinitely
[2m2016-03-18 15:20:52.240[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mc.n.http4.MonitoredConnectionManager [0;39m [2m:[0;39m Released connection is reusable.
[2m2016-03-18 15:20:52.240[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m Releasing connection [{}->http://localhost:8081][null]
[2m2016-03-18 15:20:52.240[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m Pooling connection [{}->http://localhost:8081][null]; keep alive indefinitely
[2m2016-03-18 15:20:52.240[0;39m [32mDEBUG[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mcom.netflix.http4.NamedConnectionPool [0;39m [2m:[0;39m Notifying no-one, there are no waiting threads
[2m2016-03-18 15:20:52.243[0;39m [33m WARN[0;39m [35m3388[0;39m [2m---[0;39m [2m[nio-8080-exec-2][0;39m [36mo.s.c.n.z.filters.post.SendErrorFilter [0;39m [2m:[0;39m Error during filtering
com.netflix.zuul.exception.ZuulException: Forwarding error
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:134) ~[spring-cloud-netflix-core-1.1.0.M5.jar:1.1.0.M5]
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:76) ~[spring-cloud-netflix-core-1.1.0.M5.jar:1.1.0.M5]
at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:112) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:197) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.FilterProcessor.runFilters(FilterProcessor.java:161) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.FilterProcessor.route(FilterProcessor.java:120) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.ZuulRunner.route(ZuulRunner.java:96) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.http.ZuulServlet.route(ZuulServlet.java:116) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.http.ZuulServlet.service(ZuulServlet.java:81) ~[zuul-core-1.1.0.jar:1.1.0]
at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:158) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.cloud.netflix.zuul.web.ZuulController.handleRequestInternal(ZuulController.java:43) [spring-cloud-netflix-core-1.1.0.M5.jar:1.1.0.M5]
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:147) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:860) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:237) [spring-boot-actuator-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:112) [spring-boot-actuator-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:103) [spring-boot-actuator-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) [tomcat-embed-core-8.0.32.jar:8.0.32]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_74]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.32.jar:8.0.32]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_74]
Caused by: com.netflix.hystrix.exception.HystrixRuntimeException: blue-config timed-out and no fallback available.
at com.netflix.hystrix.AbstractCommand.call(AbstractCommand.java:806) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.AbstractCommand.call(AbstractCommand.java:790) ~[hystrix-core-1.4.23.jar:1.4.23]
at rx.internal.operators.OperatorOnErrorResumeNextViaFunction.onError(OperatorOnErrorResumeNextViaFunction.java:99) ~[rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorDoOnEach.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorDoOnEach.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorDoOnEach.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.14.jar:1.0.14]
at com.netflix.hystrix.AbstractCommand$DeprecatedOnFallbackHookApplication.onError(AbstractCommand.java:1521) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.AbstractCommand$FallbackHookApplication.onError(AbstractCommand.java:1411) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.HystrixCommand.call(HystrixCommand.java:314) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.HystrixCommand.call(HystrixCommand.java:306) ~[hystrix-core-1.4.23.jar:1.4.23]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:162) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.call(Observable.java:154) ~[rxjava-1.0.14.jar:1.0.14]
at rx.Observable.unsafeSubscribe(Observable.java:7710) ~[rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorOnErrorResumeNextViaFunction.onError(OperatorOnErrorResumeNextViaFunction.java:100) ~[rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorDoOnEach.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.14.jar:1.0.14]
at rx.internal.operators.OperatorDoOnEach.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.14.jar:1.0.14]
at com.netflix.hystrix.AbstractCommand$HystrixObservableTimeoutOperator.run(AbstractCommand.java:958) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable.call(HystrixContextRunnable.java:41) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable.call(HystrixContextRunnable.java:37) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable.run(HystrixContextRunnable.java:57) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.AbstractCommand$HystrixObservableTimeoutOperator.tick(AbstractCommand.java:978) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.util.HystrixTimer.run(HystrixTimer.java:100) ~[hystrix-core-1.4.23.jar:1.4.23]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[na:1.8.0_74]
at java.util.concurrent.FutureTask.runAndReset(Unknown Source) ~[na:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access1(Unknown Source) ~[na:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[na:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_74]
... 1 common frames omitted
Caused by: java.util.concurrent.TimeoutException: null
at com.netflix.hystrix.AbstractCommand.call(AbstractCommand.java:601) ~[hystrix-core-1.4.23.jar:1.4.23]
at com.netflix.hystrix.AbstractCommand.call(AbstractCommand.java:581) ~[hystrix-core-1.4.23.jar:1.4.23]
at rx.internal.operators.OperatorOnErrorResumeNextViaFunction.onError(OperatorOnErrorResumeNextViaFunction.java:99) ~[rxjava-1.0.14.jar:1.0.14]
... 15 common frames omitted
有趣的是,似乎检测到了连接被拒绝的错误(Stale connection detected
)并且完成了对另一个实例的调用(我确实看到了传入的请求),但结果仍然是错误.我希望重试调用的响应返回给客户端。
这是一个里程碑错误还是我缺少一些配置才能使它正常工作?
原来超时的是 Hystrix。设置hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 5000
似乎可以解决问题。
谢谢斯宾塞!