Describe the bug I'm using Spring Cloud Hoxton.SR8, Spring boot 2.3.3.RELEASE
Everytime that I shutdown my spring boot instance I see that my instance if not immediatly declared as down in Eureka and I have these logs
stm1 | 2020-11-03 19:08:29.572 INFO 1 - [extShutdownHook] o.s.c.n.e.s.EurekaServiceRegistry .deregister(L65) : Unregistering application STM with eureka with status DOWN
stm1 | 2020-11-03 19:08:29.573 WARN 1 - [extShutdownHook] c.n.d.DiscoveryClient .notify(L1351) : Saw local status change event StatusChangeEvent [timestamp=1604430509573, current=DOWN, previous=UP]
stm1 | 2020-11-03 19:08:29.574 WARN 1 - [nfoReplicator-0] c.n.d.DiscoveryClient .notify(L1351) : Saw local status change event StatusChangeEvent [timestamp=1604430509574, current=UP, previous=DOWN]
stm1 | 2020-11-03 19:08:29.575 INFO 1 - [nfoReplicator-0] c.n.d.DiscoveryClient .register(L870) : DiscoveryClient_STM/stm1:stm:8090: registering service...
service-registry2 | 2020-11-03 19:08:29.583 INFO 1 --- [nio-8761-exec-5] c.n.e.registry.AbstractInstanceRegistry : Registered instance STM/stm1:stm:8090 with status UP (replication=false)
What I understand is : Springboot shutdown de-register instance from eureka StatusChangeListener.notify is called Then StatusChangeListener.notify call instanceInfoReplicator.onDemandUpdate(); onDemandUpdate call InstanceInfoReplicator.run => discoveryClient.refreshInstanceInfo(); => getHealthCheckHandler().getStatus(instanceInfo.getStatus()); => return UP
So instance is re-registered immediatly as UP
Is it normal that during shutdown, HealthCheck status is still up and override current down status set by ShutdownHook ?
Sample Basic application with these properties :
eureka.client.serviceUrl.defaultZone=${EUREKA_URI:http://localhost:8761/eureka}
eureka.client.registry-fetch-interval-seconds=10
eureka.client.healthcheck.enabled=true
eureka.instance.prefer-ip-address=true
Comment From: spencergibb
the EurekaServiceRegistry.deregister() call is explicit and unlinked from DiscoveryClient.DiscoveryClientstill has threads running.DiscoveryClient.shutdown()is already registered as a bean destroymethod. Can you set a breakpoint inDiscoveryClient.shutdown()` and see if it is called?
Comment From: spring-cloud-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-cloud-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.