【JAVA】SpringCloud Feign Ribbon Hystrix Nacos 第一次调用服务报错 close wrong [NA] failed to write cache for d

全部的报错信息如下

[20-03-21  21:30:36:824][INFO  ][org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]][http-nio-9277-exec-1]Initializing  Spring  DispatcherServlet  'dispatcherServlet'
[20-03-21  21:30:36:839][INFO  ][org.springframework.web.servlet.DispatcherServlet][http-nio-9277-exec-1]Initializing  Servlet  'dispatcherServlet'
[20-03-21  21:30:36:964][INFO  ][org.springframework.web.servlet.DispatcherServlet][http-nio-9277-exec-1]Completed  initialization  in  125  ms
[20-03-21  21:30:39:340][INFO  ][com.netflix.config.ChainedDynamicProperty][hystrix-phoenix-provider-1]Flipping  property:  phoenix-provider.ribbon.ActiveConnectionsLimit  to  use  NEXT  property:  niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit  =  2147483647
[20-03-21  21:30:39:557][INFO  ][com.netflix.loadbalancer.BaseLoadBalancer][hystrix-phoenix-provider-1]Client:  phoenix-provider  instantiated  a  LoadBalancer:  DynamicServerListLoadBalancer:{NFLoadBalancer:name=phoenix-provider,current  list  of  Servers=[],Load  balancer  stats=Zone  stats:  {},Server  stats:  []}ServerList:null
[20-03-21  21:30:39:691][INFO  ][com.netflix.loadbalancer.DynamicServerListLoadBalancer][hystrix-phoenix-provider-1]Using  serverListUpdater  PollingServerListUpdater
[20-03-21  21:30:40:660][INFO  ][com.alibaba.nacos.client.naming][hystrix-phoenix-provider-1]new  ips(2)  service:  DEFAULT_GROUP@@phoenix-provider  ->  [{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.110#9278#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.110","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9278,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0},{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.120#9276#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.120","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9276,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0}]
[20-03-21  21:30:40:687][WARN  ][com.alibaba.nacos.client.naming][hystrix-phoenix-provider-1]close  wrong
java.nio.channels.ClosedChannelException:  null
at  sun.nio.ch.FileLockImpl.release(FileLockImpl.java:58)
at  com.alibaba.nacos.client.naming.cache.ConcurrentDiskUtil.writeFileContent(ConcurrentDiskUtil.java:160)
at  com.alibaba.nacos.client.naming.cache.DiskCache.write(DiskCache.java:67)
at  com.alibaba.nacos.client.naming.core.HostReactor.processServiceJSON(HostReactor.java:178)
at  com.alibaba.nacos.client.naming.core.HostReactor.updateServiceNow(HostReactor.java:272)
at  com.alibaba.nacos.client.naming.core.HostReactor.getServiceInfo(HostReactor.java:229)
at  com.alibaba.nacos.client.naming.NacosNamingService.selectInstances(NacosNamingService.java:342)
at  com.alibaba.nacos.client.naming.NacosNamingService.selectInstances(NacosNamingService.java:334)
at  com.alibaba.nacos.client.naming.NacosNamingService.selectInstances(NacosNamingService.java:323)
at com.alibaba.nacos.client.naming.NacosNamingService.selectInstances(NacosNamingService.java:301)
at com.alibaba.cloud.nacos.ribbon.NacosServerList.getServers(NacosServerList.java:55)
at com.alibaba.cloud.nacos.ribbon.NacosServerList.getUpdatedListOfServers(NacosServerList.java:49)
at com.netflix.loadbalancer.DynamicServerListLoadBalancer.updateListOfServers(DynamicServerListLoadBalancer.java:240)
at com.netflix.loadbalancer.DynamicServerListLoadBalancer.restOfInit(DynamicServerListLoadBalancer.java:144)
at com.netflix.loadbalancer.DynamicServerListLoadBalancer.<init>(DynamicServerListLoadBalancer.java:95)
at com.netflix.loadbalancer.ZoneAwareLoadBalancer.<init>(ZoneAwareLoadBalancer.java:82)
at org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration.ribbonLoadBalancer(RibbonClientConfiguration.java:139)
at org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration$$EnhancerBySpringCGLIB$$a09b7aaf.CGLIB$ribbonLoadBalancer$4(<generated>)
at org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration$$EnhancerBySpringCGLIB$$a09b7aaf$$FastClassBySpringCGLIB$$b9f368c7.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
at org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration$$EnhancerBySpringCGLIB$$a09b7aaf.ribbonLoadBalancer(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:620)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:605)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1239)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:855)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:758)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:508)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
at org.springframework.cloud.context.named.NamedContextFactory.createContext(NamedContextFactory.java:120)
at org.springframework.cloud.context.named.NamedContextFactory.getContext(NamedContextFactory.java:88)
at org.springframework.cloud.netflix.ribbon.SpringClientFactory.getContext(SpringClientFactory.java:118)
at org.springframework.cloud.context.named.NamedContextFactory.getInstance(NamedContextFactory.java:129)
at org.springframework.cloud.netflix.ribbon.SpringClientFactory.getInstance(SpringClientFactory.java:108)
at org.springframework.cloud.netflix.ribbon.SpringClientFactory.getClientConfig(SpringClientFactory.java:65)
at org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient.getClientConfig(LoadBalancerFeignClient.java:80)
at org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:64)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:108)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:78)
at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:106)
at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)
at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.call(OperatorSubscribeOn.java:100)
at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)
at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)
at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[20-03-21 21:30:40:692][ERROR][com.alibaba.nacos.client.naming][hystrix-phoenix-provider-1][NA] failed to write cache for dom:DEFAULT_GROUP@@phoenix-provider
java.nio.channels.ClosedByInterruptException: null
at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202)
at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:216)
at com.alibaba.nacos.client.naming.cache.ConcurrentDiskUtil.writeFileContent(ConcurrentDiskUtil.java:152)
at com.alibaba.nacos.client.naming.cache.DiskCache.write(DiskCache.java:67)
at com.alibaba.nacos.client.naming.core.HostReactor.processServiceJSON(HostReactor.java:178)
at com.alibaba.nacos.client.naming.core.HostReactor.updateServiceNow(HostReactor.java:272)
at com.alibaba.nacos.client.naming.core.HostReactor.getServiceInfo(HostReactor.java:229)
at com.alibaba.nacos.client.naming.NacosNamingService.selectInstances(NacosNamingService.java:342)
at com.alibaba.nacos.client.naming.NacosNamingService.selectInstances(NacosNamingService.java:334)
at com.alibaba.nacos.client.naming.NacosNamingService.selectInstances(NacosNamingService.java:323)
at com.alibaba.nacos.client.naming.NacosNamingService.selectInstances(NacosNamingService.java:301)
at com.alibaba.cloud.nacos.ribbon.NacosServerList.getServers(NacosServerList.java:55)
at com.alibaba.cloud.nacos.ribbon.NacosServerList.getUpdatedListOfServers(NacosServerList.java:49)
at com.netflix.loadbalancer.DynamicServerListLoadBalancer.updateListOfServers(DynamicServerListLoadBalancer.java:240)
at com.netflix.loadbalancer.DynamicServerListLoadBalancer.restOfInit(DynamicServerListLoadBalancer.java:144)
at com.netflix.loadbalancer.DynamicServerListLoadBalancer.<init>(DynamicServerListLoadBalancer.java:95)
at com.netflix.loadbalancer.ZoneAwareLoadBalancer.<init>(ZoneAwareLoadBalancer.java:82)
at org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration.ribbonLoadBalancer(RibbonClientConfiguration.java:139)
at org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration$$EnhancerBySpringCGLIB$$a09b7aaf.CGLIB$ribbonLoadBalancer$4(<generated>)
at org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration$$EnhancerBySpringCGLIB$$a09b7aaf$$FastClassBySpringCGLIB$$b9f368c7.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
at org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration$$EnhancerBySpringCGLIB$$a09b7aaf.ribbonLoadBalancer(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:620)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:605)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1239)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:855)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:758)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:508)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
at org.springframework.cloud.context.named.NamedContextFactory.createContext(NamedContextFactory.java:120)
at org.springframework.cloud.context.named.NamedContextFactory.getContext(NamedContextFactory.java:88)
at org.springframework.cloud.netflix.ribbon.SpringClientFactory.getContext(SpringClientFactory.java:118)
at org.springframework.cloud.context.named.NamedContextFactory.getInstance(NamedContextFactory.java:129)
at org.springframework.cloud.netflix.ribbon.SpringClientFactory.getInstance(SpringClientFactory.java:108)
at org.springframework.cloud.netflix.ribbon.SpringClientFactory.getClientConfig(SpringClientFactory.java:65)
at org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient.getClientConfig(LoadBalancerFeignClient.java:80)
at org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:64)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:108)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:78)
at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:106)
at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)
at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.call(OperatorSubscribeOn.java:100)
at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)
at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)
at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[20-03-21 21:30:40:697][INFO ][com.alibaba.nacos.client.naming][hystrix-phoenix-provider-1]current ips:(2) service: DEFAULT_GROUP@@phoenix-provider -> [{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.120#9276#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.120","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9276,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0},{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.110#9278#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.110","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9278,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0}]
[20-03-21 21:30:40:733][INFO ][com.netflix.config.ChainedDynamicProperty][hystrix-phoenix-provider-1]Flipping property: phoenix-provider.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
[20-03-21 21:30:40:739][INFO ][com.netflix.loadbalancer.DynamicServerListLoadBalancer][hystrix-phoenix-provider-1]DynamicServerListLoadBalancer for client phoenix-provider initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=phoenix-provider,current list of Servers=[172.28.72.120:9276, 172.28.72.110:9278],Load balancer stats=Zone stats: {unknown=[Zone:unknown;	Instance count:2; Active connections count: 0;	Circuit breaker tripped count: 0;	Active connections per server: 0.0;]
},Server stats: [[Server:172.28.72.110:9278;	Zone:UNKNOWN;	Total Requests:0;	Successive connection failure:0; Total blackout seconds:0;	Last connection made:Thu Jan 01 08:00:00 CST 1970;	First connection made: Thu Jan 01 08:00:00 CST 1970; Active Connections:0;	total failure count in last (1000) msecs:0;	average resp time:0.0;	90 percentile resp time:0.0; 95 percentile resp time:0.0;	min resp time:0.0;	max resp time:0.0;	stddev resp time:0.0]
, [Server:172.28.72.120:9276;	Zone:UNKNOWN;	Total Requests:0;	Successive connection failure:0;	Total blackout seconds:0; Last connection made:Thu Jan 01 08:00:00 CST 1970;	First connection made: Thu Jan 01 08:00:00 CST 1970;	Active Connections:0; total failure count in last (1000) msecs:0;	average resp time:0.0;	90 percentile resp time:0.0;	95 percentile resp time:0.0; min resp time:0.0;	max resp time:0.0;	stddev resp time:0.0]
]}ServerList:com.alibaba.cloud.nacos.ribbon.NacosServerList@7cda374f
[20-03-21 21:30:41:931][INFO ][com.alibaba.nacos.client.naming][com.alibaba.nacos.client.naming.updater]current ips:(2) service: DEFAULT_GROUP@@phoenix-provider -> [{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.120#9276#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.120","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9276,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0},{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.110#9278#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.110","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9278,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0}]

SpringCloud结合Nacos实现服务注册发现

消费者使用Feign声明式服务调用方式,配合Ribbon实现客户端负载均衡,使用Hystrix来解决熔断问题,防止服务阻塞,但是消费者在启动后,第一次调用服务提供者的服务时,出现上述异常;本质原因是Ribbon的负载均衡相关初始化工作没有完成

两种解决方法:

延长Hystrix熔断器的超时时间

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=10000

该配置默认是1秒,1秒在首次调用时,初始化Ribbon相关信息是不够的,所以每次首次调用都会报错

配置之后首次调用的日志如下:

[20-03-21 23:20:51:398][INFO ][org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]][http-nio-9277-exec-1]Initializing Spring DispatcherServlet 'dispatcherServlet'
[20-03-21 23:20:51:399][INFO ][org.springframework.web.servlet.DispatcherServlet][http-nio-9277-exec-1]Initializing Servlet 'dispatcherServlet'
[20-03-21 23:20:51:434][INFO ][org.springframework.web.servlet.DispatcherServlet][http-nio-9277-exec-1]Completed initialization in 34 ms
[20-03-21 23:20:52:473][INFO ][com.netflix.config.ChainedDynamicProperty][hystrix-phoenix-provider-1]Flipping property: phoenix-provider.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
[20-03-21 23:20:52:509][INFO ][com.netflix.loadbalancer.BaseLoadBalancer][hystrix-phoenix-provider-1]Client: phoenix-provider instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=phoenix-provider,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
[20-03-21 23:20:52:521][INFO ][com.netflix.loadbalancer.DynamicServerListLoadBalancer][hystrix-phoenix-provider-1]Using serverListUpdater PollingServerListUpdater
[20-03-21 23:20:52:902][INFO ][com.alibaba.nacos.client.naming][hystrix-phoenix-provider-1]new ips(2) service: DEFAULT_GROUP@@phoenix-provider -> [{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.110#9278#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.110","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9278,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0},{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.120#9276#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.120","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9276,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0}]
[20-03-21 23:20:52:916][INFO ][com.alibaba.nacos.client.naming][hystrix-phoenix-provider-1]current ips:(2) service: DEFAULT_GROUP@@phoenix-provider -> [{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.120#9276#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.120","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9276,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0},{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.110#9278#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.110","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9278,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0}]
[20-03-21 23:20:52:930][INFO ][com.netflix.config.ChainedDynamicProperty][hystrix-phoenix-provider-1]Flipping property: phoenix-provider.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
[20-03-21 23:20:52:933][INFO ][com.netflix.loadbalancer.DynamicServerListLoadBalancer][hystrix-phoenix-provider-1]DynamicServerListLoadBalancer for client phoenix-provider initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=phoenix-provider,current list of Servers=[172.28.72.120:9276, 172.28.72.110:9278],Load balancer stats=Zone stats: {unknown=[Zone:unknown;	Instance count:2;	Active connections count: 0;	Circuit breaker tripped count: 0;	Active connections per server: 0.0;]
},Server stats: [[Server:172.28.72.110:9278;	Zone:UNKNOWN;	Total Requests:0;	Successive connection failure:0;	Total blackout seconds:0;	Last connection made:Thu Jan 01 08:00:00 CST 1970;	First connection made: Thu Jan 01 08:00:00 CST 1970;	Active Connections:0;	total failure count in last (1000) msecs:0;	average resp time:0.0;	90 percentile resp time:0.0;	95 percentile resp time:0.0;	min resp time:0.0;	max resp time:0.0;	stddev resp time:0.0]
, [Server:172.28.72.120:9276;	Zone:UNKNOWN;	Total Requests:0;	Successive connection failure:0;	Total blackout seconds:0;	Last connection made:Thu Jan 01 08:00:00 CST 1970;	First connection made: Thu Jan 01 08:00:00 CST 1970;	Active Connections:0;	total failure count in last (1000) msecs:0;	average resp time:0.0;	90 percentile resp time:0.0;	95 percentile resp time:0.0;	min resp time:0.0;	max resp time:0.0;	stddev resp time:0.0]
]}ServerList:com.alibaba.cloud.nacos.ribbon.NacosServerList@71aac1f2
[20-03-21 23:20:53:576][INFO ][com.netflix.config.ChainedDynamicProperty][PollingServerListUpdater-0]Flipping property: phoenix-provider.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
[20-03-21 23:20:53:990][INFO ][com.alibaba.nacos.client.naming][com.alibaba.nacos.client.naming.updater]current ips:(2) service: DEFAULT_GROUP@@phoenix-provider -> [{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.120#9276#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.120","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9276,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0},{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.110#9278#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.110","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9278,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0}]

 

Ribbon选用饥饿加载模式eager-load

ribbon.eager-load.enabled=true
ribbon.eager-load.clients=phoenix-provider

phoenix-provider是对应的服务提供者的实例名称

配置之后启动日志如下:

[20-03-21 23:17:00:639][INFO ][com.alibaba.nacos.client.config.impl.ClientWorker][restartedMain][fixed-172.28.72.120_8848] [subscribe] phoenix-consumer-local.properties+DEFAULT_GROUP
[20-03-21 23:17:00:643][INFO ][com.alibaba.nacos.client.config.impl.CacheData][restartedMain][fixed-172.28.72.120_8848] [add-listener] ok, tenant=, dataId=phoenix-consumer-local.properties, group=DEFAULT_GROUP, cnt=1
[20-03-21 23:17:00:643][INFO ][com.alibaba.nacos.client.config.impl.ClientWorker][restartedMain][fixed-172.28.72.120_8848] [subscribe] phoenix-consumer.properties+DEFAULT_GROUP
[20-03-21 23:17:00:643][INFO ][com.alibaba.nacos.client.config.impl.CacheData][restartedMain][fixed-172.28.72.120_8848] [add-listener] ok, tenant=, dataId=phoenix-consumer.properties, group=DEFAULT_GROUP, cnt=1
[20-03-21 23:17:01:357][INFO ][com.netflix.config.ChainedDynamicProperty][restartedMain]Flipping property: phoenix-provider.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
[20-03-21 23:17:01:390][INFO ][com.netflix.loadbalancer.BaseLoadBalancer][restartedMain]Client: phoenix-provider instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=phoenix-provider,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
[20-03-21 23:17:01:401][INFO ][com.netflix.loadbalancer.DynamicServerListLoadBalancer][restartedMain]Using serverListUpdater PollingServerListUpdater
[20-03-21 23:17:01:698][INFO ][com.alibaba.nacos.client.naming][restartedMain]new ips(2) service: DEFAULT_GROUP@@phoenix-provider -> [{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.110#9278#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.110","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9278,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0},{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.120#9276#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.120","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9276,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0}]
[20-03-21 23:17:01:712][INFO ][com.alibaba.nacos.client.naming][restartedMain]current ips:(2) service: DEFAULT_GROUP@@phoenix-provider -> [{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.120#9276#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.120","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9276,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0},{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"172.28.72.110#9278#DEFAULT#DEFAULT_GROUP@@phoenix-provider","ip":"172.28.72.110","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9278,"serviceName":"DEFAULT_GROUP@@phoenix-provider","weight":1.0}]
[20-03-21 23:17:01:727][INFO ][com.netflix.config.ChainedDynamicProperty][restartedMain]Flipping property: phoenix-provider.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
[20-03-21 23:17:01:731][INFO ][com.netflix.loadbalancer.DynamicServerListLoadBalancer][restartedMain]DynamicServerListLoadBalancer for client phoenix-provider initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=phoenix-provider,current list of Servers=[172.28.72.120:9276, 172.28.72.110:9278],Load balancer stats=Zone stats: {unknown=[Zone:unknown;	Instance count:2;	Active connections count: 0;	Circuit breaker tripped count: 0;	Active connections per server: 0.0;]
},Server stats: [[Server:172.28.72.110:9278;	Zone:UNKNOWN;	Total Requests:0;	Successive connection failure:0;	Total blackout seconds:0;	Last connection made:Thu Jan 01 08:00:00 CST 1970;	First connection made: Thu Jan 01 08:00:00 CST 1970;	Active Connections:0;	total failure count in last (1000) msecs:0;	average resp time:0.0;	90 percentile resp time:0.0;	95 percentile resp time:0.0;	min resp time:0.0;	max resp time:0.0;	stddev resp time:0.0]
, [Server:172.28.72.120:9276;	Zone:UNKNOWN;	Total Requests:0;	Successive connection failure:0;	Total blackout seconds:0;	Last connection made:Thu Jan 01 08:00:00 CST 1970;	First connection made: Thu Jan 01 08:00:00 CST 1970;	Active Connections:0;	total failure count in last (1000) msecs:0;	average resp time:0.0;	90 percentile resp time:0.0;	95 percentile resp time:0.0;	min resp time:0.0;	max resp time:0.0;	stddev resp time:0.0]
]}ServerList:com.alibaba.cloud.nacos.ribbon.NacosServerList@6b93fb62

 

 

©️2020 CSDN 皮肤主题: 酷酷鲨 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值