I'm using org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:2.2.2.RELEASE in a console app. On shutdown, I get an Illegal State Exception. This has supposedly been opened and fixed in the past for some scenarios, but still not fixed for console apps.

There doesn't seem to be a way to disable this logger either. The normal Spring ways don't seem to work.

Call stack below:

2020-04-11 20:27:40.373 INFO 10824 --- [extShutdownHook] c.n.u.concurrent.ShutdownEnabledTimer : Shutdown hook removed for: NFLoadBalancer-PingTimer-DTMS 2020-04-11 20:27:40.375 INFO 10824 --- [extShutdownHook] c.n.u.concurrent.ShutdownEnabledTimer : Exception caught (might be ok if at shutdown)

java.lang.IllegalStateException: Shutdown in progress at java.base/java.lang.ApplicationShutdownHooks.remove(ApplicationShutdownHooks.java:82) ~[na:na] at java.base/java.lang.Runtime.removeShutdownHook(Runtime.java:241) ~[na:na] at com.netflix.util.concurrent.ShutdownEnabledTimer.cancel(ShutdownEnabledTimer.java:70) ~[netflix-commons-util-0.1.1.jar:na] at com.netflix.loadbalancer.BaseLoadBalancer.cancelPingTask(BaseLoadBalancer.java:632) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0] at com.netflix.loadbalancer.BaseLoadBalancer.shutdown(BaseLoadBalancer.java:883) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0] at com.netflix.loadbalancer.DynamicServerListLoadBalancer.shutdown(DynamicServerListLoadBalancer.java:285) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]

Comment From: ryanjbaxter

Please learn how to format code on GitHub.

Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.

Comment From: SledgeHammer01

Please learn how to format code on GitHub.

Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.

Kind of difficult to provide a "complete" example with so many pieces...

Windows 10 Pro x64 JDK 11.0.6 Spring Boot 2.2.6 org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:2.2.2.RELEASE

This is a Spring Boot Console App. There is no "wait for keypress" or expectations of pressing control C to kill it. It's just a straight console app that runs, does its thing and exists. Here is a fuller output. Hopefully the formatting is more to your liking:

--- getCustomers() Feign ---
2020-04-13 10:18:27.386  INFO 584788 --- [           main] c.netflix.config.ChainedDynamicProperty  : Flipping property: XXXX.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2020-04-13 10:18:27.406  INFO 584788 --- [           main] c.n.u.concurrent.ShutdownEnabledTimer    : Shutdown hook installed for: NFLoadBalancer-PingTimer-XXXX
2020-04-13 10:18:27.406  INFO 584788 --- [           main] c.netflix.loadbalancer.BaseLoadBalancer  : Client: XXXX instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=XXXX,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
2020-04-13 10:18:27.410  INFO 584788 --- [           main] c.n.l.DynamicServerListLoadBalancer      : Using serverListUpdater PollingServerListUpdater
2020-04-13 10:18:27.428  INFO 584788 --- [           main] c.netflix.config.ChainedDynamicProperty  : Flipping property: XXXX.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2020-04-13 10:18:27.430  INFO 584788 --- [           main] c.n.l.DynamicServerListLoadBalancer      : DynamicServerListLoadBalancer for client XXXX initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=XXXX,current list of Servers=[XXXXXX-W1.mshome.net:8080],Load balancer stats=Zone stats: {defaultzone=[Zone:defaultzone;    Instance count:1;   Active connections count: 0;    Circuit breaker tripped count: 0;   Active connections per server: 0.0;]
},Server stats: [[Server:XXXXXX-W1.mshome.net:8080; Zone:defaultZone;   Total Requests:0;   Successive connection failure:0;    Total blackout seconds:0;   Last connection made:Wed Dec 31 16:00:00 PST 1969;  First connection made: Wed Dec 31 16:00:00 PST 1969;    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:org.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList@c697186
100000 Bob Jenkins
  User
  Admin
100001 Bill White
  Super User
100002 John Smith
  Super User
2020-04-13 10:18:27.506  INFO 584788 --- [      Thread-20] c.n.l.PollingServerListUpdater           : Shutting down the Executor Pool for PollingServerListUpdater
2020-04-13 10:18:27.507  INFO 584788 --- [extShutdownHook] o.s.c.n.e.s.EurekaServiceRegistry        : Unregistering application XXXX TEST with eureka with status DOWN
2020-04-13 10:18:27.507  WARN 584788 --- [extShutdownHook] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [timestamp=1586798307507, current=DOWN, previous=UP]
2020-04-13 10:18:27.507  INFO 584788 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_XXXX TEST/XXXXXX-W1.mshome.net:XXXX Test: registering service...
2020-04-13 10:18:27.512  INFO 584788 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_XXXX TEST/XXXXXX-W1.mshome.net:XXXX Test - registration status: 204
2020-04-13 10:18:29.529  INFO 584788 --- [extShutdownHook] c.n.u.concurrent.ShutdownEnabledTimer    : Shutdown hook removed for: NFLoadBalancer-PingTimer-XXXX
2020-04-13 10:18:29.532  INFO 584788 --- [extShutdownHook] c.n.u.concurrent.ShutdownEnabledTimer    : Exception caught (might be ok if at shutdown)

java.lang.IllegalStateException: Shutdown in progress
    at java.base/java.lang.ApplicationShutdownHooks.remove(ApplicationShutdownHooks.java:82) ~[na:na]
    at java.base/java.lang.Runtime.removeShutdownHook(Runtime.java:241) ~[na:na]
    at com.netflix.util.concurrent.ShutdownEnabledTimer.cancel(ShutdownEnabledTimer.java:70) ~[netflix-commons-util-0.1.1.jar:na]
    at com.netflix.loadbalancer.BaseLoadBalancer.cancelPingTask(BaseLoadBalancer.java:632) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
    at com.netflix.loadbalancer.BaseLoadBalancer.shutdown(BaseLoadBalancer.java:883) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
    at com.netflix.loadbalancer.DynamicServerListLoadBalancer.shutdown(DynamicServerListLoadBalancer.java:285) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
    at org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:339) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:273) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:571) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:543) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:1075) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:504) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:1068) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1060) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1029) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:978) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.cloud.context.named.NamedContextFactory.destroy(NamedContextFactory.java:92) ~[spring-cloud-context-2.2.2.RELEASE.jar:2.2.2.RELEASE]
    at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:258) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:571) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:543) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:1075) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:504) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:1068) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1060) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1029) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:948) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]

2020-04-13 10:18:29.535  INFO 584788 --- [extShutdownHook] com.netflix.discovery.DiscoveryClient    : Shutting down DiscoveryClient ...
2020-04-13 10:18:32.538  INFO 584788 --- [extShutdownHook] com.netflix.discovery.DiscoveryClient    : Unregistering ...
2020-04-13 10:18:32.543  INFO 584788 --- [extShutdownHook] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_XXXX TEST/XXXXXX-W1.mshome.net:XXXX Test - deregister  status: 200
2020-04-13 10:18:32.554  INFO 584788 --- [extShutdownHook] com.netflix.discovery.DiscoveryClient    : Completed shut down of DiscoveryClient

Comment From: OlgaMaciaszek

@SledgeHammer01 please provide a sample project repo link with the complete, minimal, verifiable sample, as @ryanjbaxter has requested above - only then we will be able to triage the issue.

Comment From: spring-projects-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: SledgeHammer01

@olegz Here is a demo that repros the issue. demo.zip

Comment From: spencergibb

@SledgeHammer01 can you explain how to replicate the error given the project?

Comment From: spencergibb

This is an INFO log statement, as com.netflix.util.concurrent.ShutdownEnabledTimer is trying to remove a shutdown hook. If you don't want it set logging.level.com.netflix.util.concurrent.ShutdownEnabledTimer=WARN.

Comment From: SledgeHammer01

@spencergibb I was doing that as a work-around, just concerned if that would cause any issues like leaks, etc. as it is an exception.

Comment From: spencergibb

It's an info log, so no