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

Discovery does not recognise new instances or removed instances #45

Closed
sigrist opened this issue Nov 2, 2015 · 3 comments
Closed

Discovery does not recognise new instances or removed instances #45

sigrist opened this issue Nov 2, 2015 · 3 comments
Labels

Comments

@sigrist
Copy link

sigrist commented Nov 2, 2015

Hi all,

I'm starting to use Zookeeper for service discovery with Spring Cloud. I created a simple application to demonstrate my issue. My client does not recognise when new instances are available or, even worse, when an instance is not available. The code for this example is https://github.com/sigrist/zookeeper-sandbox

I created a simple HTTP service that sends a Hello. I build a client service that uses this 'Hello Service'. If I started 2 or more services before the client, I can see that the load balancer works as expected, calling all the available instances. But if I shutdown one of the servers, the client still tries to connect to it, failing and showing the Default value for a failed request (using Netflix Hystrix).

If I started new server instances, the client does not recognise then, using only the available at boot time.

When I started new servers, I can see in the Client log that a new instance is available, but the server list is not updated:

2015-11-02 12:36:36.314  INFO 35764 --- [-ServiceCache-0] .w.DependencyStateChangeListenerRegistry : Service cache state change for '/zookeeper-sandbox' instances, current service state: CONNECTED

Also, when I shutdown one server instance, a log in the client shows a new event:

2015-11-02 12:37:29.646  INFO 35764 --- [-ServiceCache-0] .w.DependencyStateChangeListenerRegistry : Service cache state change for '/zookeeper-sandbox' instances, current service state: CONNECTED

My question is, how to update the server list in the client? Is there some configuration that I'm missing?

Thanks
Sigrist

@spencergibb
Copy link
Member

I haven't tried your project yet, but the sample recognizes new and removed instances.

@spencergibb
Copy link
Member

So the issue is that DependenciesBasedLoadBalancer does not extend DynamicServerListLoadBalancer, just BaseLoadBalancer which doesn't update the list of instances from Zookeeper. The workaround is to not use the dependencies for now. /cc @marcingrzejszczak

@spencergibb spencergibb added the bug label Nov 2, 2015
@spencergibb spencergibb changed the title Discovery does not recognise new instances or removed instances? Discovery does not recognise new instances or removed instances Nov 2, 2015
marcingrzejszczak added a commit to marcingrzejszczak/spring-cloud-zookeeper that referenced this issue Nov 2, 2015
marcingrzejszczak added a commit to marcingrzejszczak/spring-cloud-zookeeper that referenced this issue Nov 3, 2015
marcingrzejszczak added a commit to marcingrzejszczak/spring-cloud-zookeeper that referenced this issue Nov 4, 2015
marcingrzejszczak added a commit to marcingrzejszczak/spring-cloud-zookeeper that referenced this issue Nov 4, 2015
@spencergibb
Copy link
Member

Thanks @sigrist for the report and @marcingrzejszczak for the fix!

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

No branches or pull requests

2 participants