-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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
[Dubbo-2233] fix reference config cache issue #2233 #2347
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2347 +/- ##
============================================
- Coverage 54.85% 54.78% -0.08%
+ Complexity 5241 5237 -4
============================================
Files 573 573
Lines 25456 25458 +2
Branches 4537 4538 +1
============================================
- Hits 13965 13948 -17
- Misses 9399 9415 +16
- Partials 2092 2095 +3
Continue to review full report at Codecov.
|
@YoungHu I try to reproduce the problem with the following client code, ReferenceConfig<DemoService> reference = new ReferenceConfig<>();
reference.setApplication(new ApplicationConfig("first-dubbo-client"));
reference.setRegistry(new RegistryConfig("multicast://224.5.6.7:1234"));
reference.setInterface(DemoService.class);
System.in.read(); // stop provider before continuing
ReferenceConfigCache cache = ReferenceConfigCache.getCache();
try {
DemoService greetingsService = cache.get(reference);
String message = greetingsService.sayHello("dubbo");
System.out.println(message);
} catch (Exception e) {
e.printStackTrace();
}
System.in.read(); // start provider before continuing
DemoService greetingsService = cache.get(reference);
// GreetingsService greetingsService = reference.get();
String message = greetingsService.sayHello("dubbo");
System.out.println(message); With the newest master, it works. That means the second invocation succeed. Is my client suitable for reproducing the problem ? |
there is something wrong with your client code, first time you already up the provider, please check the test code i commit with this PR, you can find that test will failed without change the |
@YoungHu My mistake. But the following code can also get the right response. // not start provider, just run client
ReferenceConfig<DemoService> reference = new ReferenceConfig<>();
reference.setApplication(new ApplicationConfig("first-dubbo-client"));
reference.setRegistry(new RegistryConfig("multicast://224.5.6.7:1234"));
reference.setInterface(DemoService.class);
ReferenceConfigCache cache = ReferenceConfigCache.getCache();
try {
DemoService greetingsService = cache.get(reference);
String message = greetingsService.sayHello("dubbo");
System.out.println(message);
} catch (Exception e) {
e.printStackTrace();
}
System.in.read(); // start provider before continuing
DemoService greetingsService = cache.get(reference);
// GreetingsService greetingsService = reference.get();
String message = greetingsService.sayHello("dubbo");
System.out.println(message); So what's my code's problem ? |
OK, thanks, I'll try it with the zk registry. |
I use the newest master branch, it's ok. Refer to #1999 So could u please file a new PR? |
confirmed this issue fix at master branch with #1999 ,close this one |
What is the purpose of the change
fix issue #2233
Brief changelog
fix the referenceconfig cache null forever if no provider and then provider startup
Verifying this change
Follow this checklist to help us incorporate your contribution quickly and easily:
[Dubbo-XXX] Fix UnknownException when host config not exist #XXX
. Each commit in the pull request should have a meaningful subject line and body.mvn clean install -DskipTests
&mvn clean test-compile failsafe:integration-test
to make sure unit-test and integration-test pass.