Netflix / eureka

AWS Service registry for resilient mid-tier load balancing and failover.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WARN Ignoring onDemand update due to rate limiter

Selaron opened this issue · comments

We get a warning log message on start up WARN Ignoring onDemand update due to rate limiter.

The onDemandUpdate is called three times:

Breakpoint reached
	at com.netflix.discovery.InstanceInfoReplicator.onDemandUpdate(InstanceInfoReplicator.java:88)
	at com.netflix.discovery.DiscoveryClient.registerHealthCheck(DiscoveryClient.java:638)
	at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.java:322)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140)

Breakpoint reached
	at com.netflix.discovery.InstanceInfoReplicator.onDemandUpdate(InstanceInfoReplicator.java:88)
	at com.netflix.discovery.DiscoveryClient$3.notify(DiscoveryClient.java:1297)
	at com.netflix.appinfo.ApplicationInfoManager.setInstanceStatus(ApplicationInfoManager.java:176)
	at com.netflix.discovery.DiscoveryClient.refreshInstanceInfo(DiscoveryClient.java:1391)
	at com.netflix.discovery.InstanceInfoReplicator.run(InstanceInfoReplicator.java:117)
	at com.netflix.discovery.InstanceInfoReplicator$1.run(InstanceInfoReplicator.java:101)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
	at java.util.concurrent.FutureTask.run(FutureTask.java:-1)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.lang.Thread.run(Thread.java:840)

Breakpoint reached
	at com.netflix.discovery.InstanceInfoReplicator.onDemandUpdate(InstanceInfoReplicator.java:88)
	at com.netflix.discovery.DiscoveryClient.registerHealthCheck(DiscoveryClient.java:638)
	at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.lambda$register$0(EurekaServiceRegistry.java:48)
	at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry$$Lambda$2070/0x00007f30ecd712f0.accept(Unknown Source:-1)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider.ifAvailable(DefaultListableBeanFactory.java:2126)

Maybe this could be fixed if the registerHealthCheck method would recognize second invocation with the same healthCheckerHandler:

public void registerHealthCheck(HealthCheckHandler healthCheckHandler) {
    if (instanceInfo == null) {
        logger.error("Cannot register a healthcheck handler when instance info is null!");
    }
    if (healthCheckHandler != null) {
        if (this.healthCheckHandlerRef.getAndSet(healthCheckHandler) != healthCheckHandler) {
            // schedule an onDemand update of the instanceInfo when a new healthcheck handler is registered
            if (instanceInfoReplicator != null) {
                instanceInfoReplicator.onDemandUpdate();
            }
        } else {
            logger.debug("Same healthCheckHandler registered twice.");
        }
    }
}