Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoking /management/refresh on service endpoints results in service getting de-registered. #1652

Closed
devlanp opened this issue Jan 27, 2017 · 12 comments

Comments

@devlanp
Copy link

devlanp commented Jan 27, 2017

Overview of the issue

Invoking /refresh on service endpoints results in service getting de-registered.

Motivation for or Use Case

Was trying to reload the configurations using @RefreshScope

Reproduce the error

Bring up Registry
Bring up any service
Call /management/refresh on the service.

Related issues

#421

Version

spring-cloud-starter (1.1.3.Release)

@ryanjbaxter
Copy link
Contributor

Did you say you had a sample app to reproduce the issue?

@devlanp
Copy link
Author

devlanp commented Jan 29, 2017

@ryanjbaxter @dsyer Thanks for your help.

Following are the details.

I m using the Jhipster (https://jhipster.github.io/) stack to develop micro service.

Following are the steps to reproduce:

Registry:
https://github.com/jhipster/jhipster-registry

Service:
Attached.
test.zip

Steps to reproduce:

  1. Start registry,
  2. Start service.
  3. Place a post request to the endpoint: http://localhost:8081/management/refresh
  4. The service logs would read:
    Shutting down DiscoveryClient ...
    Unregistering ...
    DiscoveryClient_TEST/test:8e580d0c17f4b27396089018c4b32b98 - deregister status: 200

I'll keep the thread posted on my findings. Let me know if I missed anything.

@spencergibb
Copy link
Member

Using a very old version Brixton.SR7

@devlanp
Copy link
Author

devlanp commented Feb 4, 2017

@spencergibb I see this happening even with Camden.SR4. What am I missing then?

@ryanjbaxter
Copy link
Contributor

I bumped the version to Camden.SR5 and made a POST to http://localhost:8081/management/refresh. Everything worked as expected.

2017-02-23 13:15:36.775  INFO 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : Shutting down DiscoveryClient ...
2017-02-23 13:15:36.776  INFO 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : Unregistering ...
2017-02-23 13:15:36.781  INFO 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_TEST/test:217780f8b59a18e25946dbd6970a7f1c - deregister  status: 200
2017-02-23 13:15:36.782  INFO 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : Completed shut down of DiscoveryClient
2017-02-23 13:15:36.786  INFO 44332 --- [  XNIO-2 task-4] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2017-02-23 13:15:36.786  INFO 44332 --- [  XNIO-2 task-4] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2017-02-23 13:15:36.786  INFO 44332 --- [  XNIO-2 task-4] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2017-02-23 13:15:36.786  INFO 44332 --- [  XNIO-2 task-4] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2017-02-23 13:15:36.892  INFO 44332 --- [  XNIO-2 task-4] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2017-02-23 13:15:36.893  INFO 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : Disable delta property : false
2017-02-23 13:15:36.893  INFO 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : Single vip registry refresh property : null
2017-02-23 13:15:36.893  INFO 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : Force full registry fetch : false
2017-02-23 13:15:36.893  INFO 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : Application is null : false
2017-02-23 13:15:36.893  INFO 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : Registered Applications size is zero : true
2017-02-23 13:15:36.893  INFO 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : Application version is -1: true
2017-02-23 13:15:36.893  INFO 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : Getting all instance registry info from the eureka server
2017-02-23 13:15:36.897  INFO 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : The response status is 200
2017-02-23 13:15:36.898  INFO 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : Starting heartbeat executor: renew interval is: 30
2017-02-23 13:15:36.898  INFO 44332 --- [  XNIO-2 task-4] c.n.discovery.InstanceInfoReplicator     : InstanceInfoReplicator onDemand update allowed rate per min is 4
2017-02-23 13:15:36.899  INFO 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1487873736899 with initial instances count: 1
2017-02-23 13:15:36.900  WARN 44332 --- [  XNIO-2 task-4] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [timestamp=1487873736900, current=UP, previous=DOWN]
2017-02-23 13:15:36.901  INFO 44332 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_TEST/test:147781fb281c4c00c262233092ee3fbc: registering service...
2017-02-23 13:15:36.912  INFO 44332 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_TEST/test:147781fb281c4c00c262233092ee3fbc - registration status: 204

@devlanp
Copy link
Author

devlanp commented Feb 27, 2017

I see the following traces and doubt if it is correct! Unregistering, followed by re-register ?

[ XNIO-2 task-4] com.netflix.discovery.DiscoveryClient : Unregistering ...
[ XNIO-2 task-4] com.netflix.discovery.DiscoveryClient : DiscoveryClient_TEST/test:217780f8b59a18e25946dbd6970a7f1c - deregister status: 200
[ XNIO-2 task-4] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1487873736900, current=UP, previous=DOWN]

@ryanjbaxter
Copy link
Contributor

Why wouldn't you expect that? You are restarting the app, so it makes sense that the app would unregister with Eureka when shutting down and then re-register once it starts back up.

@devlanp
Copy link
Author

devlanp commented Feb 27, 2017

Ryan, feel free to correct my understanding. The issue is in /management/refresh call which is just the configuration refresh and I m not expecting the service to get registered and de-registered and the log says it has de-registered. Am I missing anything?

@ryanjbaxter
Copy link
Contributor

I believe it has to do with the fact that calling /refresh will cause all the beans to be recreating. Since the DiscoveryClient class is registered as a bean it will be destroyed and then recreated. When the bean is being destroyed this will cause the shutdown method to be called.

@devlanp
Copy link
Author

devlanp commented Feb 27, 2017

#421. Going by this, I thought its an issue and it is already fixed.

@ryanjbaxter
Copy link
Contributor

#421 was about PERMANENTLY deregistering the application. In you case it deregisters the application and then reregisters it. So it seems to be working as expected.

@devlanp
Copy link
Author

devlanp commented Feb 27, 2017

Ok. Thanks for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants