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

add dubbo-samples-consul demo #73

Closed
Moriadry-zz opened this issue Apr 25, 2019 · 10 comments
Closed

add dubbo-samples-consul demo #73

Moriadry-zz opened this issue Apr 25, 2019 · 10 comments

Comments

@Moriadry-zz
Copy link

add dubbo-samples-consul demo

@beiwei30
Copy link
Member

@moriadry I added a very basic consul demo: https://github.com/apache/incubator-dubbo-samples/tree/master/dubbo-samples-consul. Feel free to enhance.

With this sample, the TCP check works as expected, pls. take a look.

@Moriadry-zz
Copy link
Author

@beiwei30 yes, I will take a look, thanks.

@beiwei30
Copy link
Member

the only flaw of TCP check is: if there's no client connected, the provider will keep printing when consul send a TCP request to dubbo's port, which is quite annoying:

Apr 30, 2019 2:12:38 PM org.apache.dubbo.remoting.transport.AbstractServer warn
WARNING:  [DUBBO] All clients has disconnected from 0.0.0.0/0.0.0.0:20880. You can graceful shutdown now., dubbo version: 2.7.1, current host: 30.5.124.198
Apr 30, 2019 2:12:48 PM org.apache.dubbo.remoting.transport.AbstractServer warn
WARNING:  [DUBBO] All clients has disconnected from 0.0.0.0/0.0.0.0:20880. You can graceful shutdown now., dubbo version: 2.7.1, current host: 30.5.124.198

@Moriadry-zz
Copy link
Author

Moriadry-zz commented Apr 30, 2019

Hi Ian, it seems the sample works fine. I believe some code in ConsulRegistry.java went wrong, they don't work correctly with the TCP check. you can get correct response because you use the subscribed variable to get URL subscribed, rather than the msg from consul(not quite sure about this).

pls check this branch : https://github.com/Moriadry/incubator-dubbo/tree/feature/fordebug with this two different version of ConsulRegistry, and debug ConsulRegistryTest.testSubscribe locally, you will find the difference.

you can debug ConsulRegistryTest.testSubscribe.java, make a breakpoint at https://github.com/apache/incubator-dubbo/blob/e2f3346d9d1dff2bf6bf3ac2802e83d46b9923c0/dubbo-registry/dubbo-registry-consul/src/main/java/org/apache/dubbo/registry/consul/ConsulRegistry.java#L135
you will figure out we cannot get a NonEmpty HealthService list response returned. But with http-ttl Check, we can get correct HealthService list.

I believe our usage of TCP check is incorrect, we can spend more time on this to figure it out. I'm trying to fix it. I'm on my vocation those days, so it needs a few days.

@Moriadry-zz
Copy link
Author

Or we can just use http ttl Check, those two checks are both the typical usage provided by consul.io, I believe their robustness can be consider mostly equal :) In case we can't figure this out :(

@beiwei30
Copy link
Member

@moriadry pls. consider to create a http ttl check pull request, based on my previous change.

@beiwei30
Copy link
Member

pls check this branch : https://github.com/Moriadry/incubator-dubbo/tree/feature/fordebug with this two different version of ConsulRegistry, and debug ConsulRegistryTest.testSubscribe locally, you will find the difference.

you can debug ConsulRegistryTest.testSubscribe.java, make a breakpoint at https://github.com/apache/incubator-dubbo/blob/e2f3346d9d1dff2bf6bf3ac2802e83d46b9923c0/dubbo-registry/dubbo-registry-consul/src/main/java/org/apache/dubbo/registry/consul/ConsulRegistry.java#L135
you will figure out we cannot get a NonEmpty HealthService list response returned. But with http-ttl Check, we can get correct HealthService list.

It this the exact change I have merged into the main trunk?

@beiwei30
Copy link
Member

@moriadry I checked your unit test, since you do not register any service in advanced, isn't it expected an empty list returned?

@Moriadry-zz
Copy link
Author

Moriadry-zz commented Apr 30, 2019

@beiwei30 With my uint test, if you use two different consulregistry(tcp and http), getHealthService will return different result(one is empty, one is not, when you register same service again). In your merged version, still use tcp, but lookup URL method without setPassing(true).

Let me just create a http-ttl-check pull request anyway.

ijaychang pushed a commit to ijaychang/dubbo-samples that referenced this issue Dec 24, 2021
@moonlighf
Copy link

how to solve the provider will keep printing when consul send a TCP request to dubbo's port and print [DUBBO] All clients has disconnected from 0.0.0.0/0.0.0.0:20880.

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