dubbo: [Bug] Multiple Implementations of an Interface: Consumer Service Fails to Detect Newly Online Provider
Pre-check
- I am sure that all the content I provide is in English.
Search before asking
- I had searched in the issues and found no similar issues.
Apache Dubbo Component
Java SDK (apache/dubbo)
Dubbo Version
dubbo 3.2.5 dubbo 3.3.4
Steps to reproduce this issue
There is one consumer (demo-consumer) and two providers (demo-provider and demo-provider2).
Both providers implement the org.example.DemoService interface, and the consumer continuously calls this interface in a loop.
To make the results easier to observe, I customized a router via SPI so that the consumer only routes calls to instances of demo-provider2.
At the beginning, only demo-provider is running, so all consumer calls fail. After demo-provider2 comes online, the expected behavior is that the consumer should then be able to successfully make calls — but in reality, it still fails.
One special thing I noticed is that I created two references to DemoService in the consumer. One reference is able to call demo-provider2 successfully, while the other still fails.
To reliably reproduce the issue, you must:
- Delete the
.dubbofolder under your home directory before starting the experiment. - Remove
demo-provider2from theorg.example.DemoServicemapping file.
This problem only occurs the first time demo-provider2 comes online.
I have created two demo projects to reproduce the issue:
How to start the two providers:
java -jar -DappName=demo-provider -Dport=20880 target/provider.jar
java -jar -DappName=demo-provider2 -Dport=20881 target/provider.jar
What you expected to happen
everything goes fine
Anything else
No response
Are you willing to submit a pull request to fix on your own?
- Yes I am willing to submit a pull request on my own!
Code of Conduct
- I agree to follow this project’s Code of Conduct
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (19 by maintainers)
There’s a key point here: the issue can only be reproduced if the two Dubbo references have some configuration differences. For example:
@DubboReference private DemoService demoService;
@DubboReference(timeout = 1000) private DemoService demoService2;