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

Services are not unregistering properly in docker container #3654

Closed
xetys opened this issue May 27, 2016 · 7 comments
Closed

Services are not unregistering properly in docker container #3654

xetys opened this issue May 27, 2016 · 7 comments

Comments

@xetys
Copy link
Member

xetys commented May 27, 2016

Whenever you run a JHipster microservice application without docker container it is unregistering itself immediatly when is stopped, so it disappears in eureka server and is no longer offered for load balancer in zuul....

this is not happening when using docker. You can easily reproduce it by start a jhipster microservice setup with docker-compose up -d and then stop and start it several times. you will quickly get several dead instances inside of zuul....

I am not sure, but this was working before....and it is still working without docker...

@jdubois
Copy link
Member

jdubois commented May 27, 2016

It depends on how the instance is killed, but probably if you do a docker-compose down then JHipster doesn't have the time to send a notification, so indeed the registry doesn't know it was removed.
I don't think there is anything we can do about it.
It works differently if you kill the app "nicely", as there is a shutdown hook that is triggered, and JHipster can send the notification before dying. This is what happens "outside Docker", probably.
If you wait a little bit, dead instances should disappear from the Registry, after a timeout: there's a heartbeat that should handle that issue after some time. It could be configured to be more aggressive, but we keep the default Netflix Eureka configuration, as usual.

@jdubois jdubois closed this as completed Jun 3, 2016
@jdubois jdubois modified the milestone: 3.4.1 Jun 13, 2016
@pascalgrimaud
Copy link
Member

@xetys / @jdubois : for your information, I have the same thing on my current project.
There is an interesting ticket opened here: see spring-cloud/spring-cloud-netflix#1322

So I tested this config on my registry:

eureka:
    server:
        enable-self-preservation: false

Here the log I have:

2016-09-08 11:00:17.875  INFO 12828 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2016-09-08 11:01:17.875  INFO 12828 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2016-09-08 11:01:17.876  INFO 12828 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Evicting 1 items (expired=1, evictionLimit=1)
2016-09-08 11:01:17.876  WARN 12828 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : DS: Registry: expired lease for MSXXXX/msxxxx:edaf71c06bb773379b435e1c39f61e50
2016-09-08 11:01:17.878  INFO 12828 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Cancelled instance MSXXXX/msxxxx:edaf71c06bb773379b435e1c39f61e50 (replication=false)

And the instance is cleared on the home page of the registry

@ruddell
Copy link
Member

ruddell commented Sep 12, 2016

I had the same thing happening with my registry (see screenshot). It caused an issue where requests would fail because they are trying to request from a non-existing microservice. Following @pascalgrimaud's tip fixed my issue. Should this be included in the registry by default (or at least document)?
screen shot 2016-09-08 at 12 50 18 pm

@jdubois
Copy link
Member

jdubois commented Sep 13, 2016

OK I'm re-opening this, let's try this out, and fix it if needed.

@jdubois jdubois reopened this Sep 13, 2016
@xetys
Copy link
Member Author

xetys commented Sep 13, 2016

I am also trying self-preservation mode to false, but still got zombie applications in eureka...maybe I am still missing something?

@xetys
Copy link
Member Author

xetys commented Sep 13, 2016

i tried to play with different attributes like enablePreservationMode, renewalThresholdUpdateIntervalMs, and evictionIntervalTimerInMs...

after about 2 minutes after service kill my registry is recognizing the dead service....for frequent updates this is really uggly...

pascalgrimaud added a commit to pascalgrimaud/jhipster-registry that referenced this issue Sep 27, 2016
- the evict task will unregister the services properly
- see jhipster/generator-jhipster#3654
@jdubois
Copy link
Member

jdubois commented Sep 27, 2016

Closing this as I merged @pascalgrimaud's PR on the registry (note to self: I need to merge this in the master branch and do a new release of the Registry).

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

No branches or pull requests

4 participants