alibaba / nacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
https://nacos.io
Apache License 2.0
29.48k stars 12.67k forks source link

only one consumer show error No provider available #2631

Closed liuchenrang closed 3 years ago

liuchenrang commented 4 years ago

Issue Description

only one consumer show error: No provider available from registry localhost:8848 for service。 只有一个消费者和生产者是,消费者段报错误,No provider available from registry localhost:8848 for service。此时注册注册中心是有的。随便修改注册中心的配置,会触发同时,服务恢复正常。 Type: bug report or feature request

Describe what happened (or what feature you want)

only one consumer and only provider,when first request dubbo service ref,nacos 只有一个消费者和生产者是,当 消费者第一次请求dubo服务是, nacos会通知订阅者,debug发现 notifySubscriber will happen three times,when time eq three,now nacos consumer in servcie 会产生三次notifySubscriber, 当是第三次是,通知得的的实例数量为0, 如果为零 将触发如下代码 discover instance is 0, if instance size is 0, List<URL> urls = toUrlWithEmpty(url, healthyInstances), , this code will produce empty://url, this will induce override nacos client provider cache,content is 将会产生一个 empty的无效网址,导致nacos本地缓存被覆盖为无效地址,内容如下 org.people.xinghuo.service.DemoService\:1.0.0=empty\://192.168.20.93/org.people.xinghuo.service.DemoService?application\=orderProvider&category\=providers&check\=false&dubbo\=2.0.2&interface\=org.people.xinghuo.service.DemoService&metadata-type\=remote&methods\=sayName&pid\=12624&qos.enable\=false&qos.port\=3333&release\=2.7.6&revision\=1.0.0&side\=consumer&sticky\=false&timestamp\=1586850688343&version\=1.0.0 i think this problem,dubbo and nacos poor coordination ,now nacos server is only zero 我理解这个问题,是应该dubbo这边支持的nacos服务发现任务,确实是没有。而nacos认为注册这个消费者也没有注册好,出在中间过程 consumer,becouse it doing start, so it think is zero

Describe what you expected to happen

only one consumer and only provider, should be get result ,instead of error。 当只有一个消费者与提供者是,应该返回正常的调用结果 wen use redis serve as register server,no happen this problem。 当使用redis 作为注册中心,没有发现这个问题。

How to reproduce it (as minimally and precisely as possible)

  1. one provider
  2. one consumer
  3. git demo address https://github.com/liuchenrang/demo-spring-dubbo

Tell us your environment

org.apache.dubbo dubbo-spring-boot-starter 2.7.6 com.alibaba.boot nacos-discovery-spring-boot-starter 0.2.7
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.6.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

Anything else we need to know?

JarkimZhu commented 4 years ago

I got this issue too, did you resloved ?

sdoseabow commented 3 years ago

same problem dubbo version 2.7.6 ,com.alibaba.nacos version 1.1.1

stale[bot] commented 3 years ago

Thanks for your feedback and contribution. But the issue/pull request has not had recent activity more than 180 days. This issue/pull request will be closed if no further activity occurs 7 days later. We may solve this issue in new version. So can you upgrade to newest version and retry? If there are still issues or want to contribute again. Please create new issue or pull request again.