You are viewing a plain text version of this content. The canonical link for it is here.
Posted to devnull@infra.apache.org by "YoungHu (GitHub)" <gi...@apache.org> on 2018/08/25 03:30:56 UTC

[GitHub] [incubator-dubbo] YoungHu opened pull request #2347: [Dubbo-2233] fix reference config cache issue #2233

## 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
1. provider not startup
2. invoke with reference cache get null
3. provider startup
4. invoker with reference cache again get what you want

Follow this checklist to help us incorporate your contribution quickly and easily:

- [x] Make sure there is a [GITHUB_issue](https://github.com/apache/incubator-dubbo/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
- [x] Format the pull request title like `[Dubbo-XXX] Fix UnknownException when host config not exist #XXX`. Each commit in the pull request should have a meaningful subject line and body.
- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/incubator-dubbo/tree/master/dubbo-test).
- [x] Run `mvn clean install -DskipTests` & `mvn clean test-compile failsafe:integration-test` to make sure unit-test and integration-test pass.
- [x] If this contribution is large, please follow the [Software Donation Guide](https://github.com/apache/incubator-dubbo/wiki/Software-donation-guide).


[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2347 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-dubbo] YoungHu commented on issue #2347: [Dubbo-2233] fix reference config cache issue #2233

Posted by "YoungHu (GitHub)" <gi...@apache.org>.
below is my code and test result, dubbo version is 2.6.2. why can't reproduce what I said, you may need find it out by yourself. because i can't get more information from you.
![wx20180829-211015](https://user-images.githubusercontent.com/7418602/44789980-9e2b8680-abd0-11e8-9585-78d374232934.png)


[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2347 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-dubbo] YoungHu commented on issue #2347: [Dubbo-2233] fix reference config cache issue #2233

Posted by "YoungHu (GitHub)" <gi...@apache.org>.
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 `ReferenceConfigCache.java` code

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2347 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-dubbo] diecui1202 commented on issue #2347: [Dubbo-2233] fix reference config cache issue #2233

Posted by "diecui1202 (GitHub)" <gi...@apache.org>.
@YoungHu I try to reproduce the problem with the following client code,

```java
        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 provide 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 ?

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2347 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-dubbo] diecui1202 commented on issue #2347: [Dubbo-2233] fix reference config cache issue #2233

Posted by "diecui1202 (GitHub)" <gi...@apache.org>.
OK, thanks, I'll try it with the zk registry. 

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2347 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-dubbo] YoungHu commented on issue #2347: [Dubbo-2233] fix reference config cache issue #2233

Posted by "YoungHu (GitHub)" <gi...@apache.org>.
confirmed this issue fix at master branch with #1999 ,close this one 

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2347 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-dubbo] codecov-io commented on issue #2347: [Dubbo-2233] fix reference config cache issue #2233

Posted by "codecov-io (GitHub)" <gi...@apache.org>.
# [Codecov](https://codecov.io/gh/apache/incubator-dubbo/pull/2347?src=pr&el=h1) Report
> Merging [#2347](https://codecov.io/gh/apache/incubator-dubbo/pull/2347?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-dubbo/commit/f720ccb965d490e6cc328af8d3e9820cb6eaf8f7?src=pr&el=desc) will **decrease** coverage by `0.07%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-dubbo/pull/2347/graphs/tree.svg?src=pr&token=VnEIkiFQT0&width=650&height=150)](https://codecov.io/gh/apache/incubator-dubbo/pull/2347?src=pr&el=tree)

```diff
@@             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
```


| [Impacted Files](https://codecov.io/gh/apache/incubator-dubbo/pull/2347?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...pache/dubbo/config/utils/ReferenceConfigCache.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2347/diff?src=pr&el=tree#diff-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy91dGlscy9SZWZlcmVuY2VDb25maWdDYWNoZS5qYXZh) | `77.55% <100%> (+0.95%)` | `12 <0> (+1)` | :arrow_up: |
| [...apache/dubbo/rpc/protocol/dubbo/FutureAdapter.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2347/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0Z1dHVyZUFkYXB0ZXIuamF2YQ==) | `58.06% <0%> (-6.46%)` | `3% <0%> (ø)` | |
| [...ubbo/rpc/protocol/dubbo/ChannelWrappedInvoker.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2347/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0NoYW5uZWxXcmFwcGVkSW52b2tlci5qYXZh) | `41.66% <0%> (-4.17%)` | `3% <0%> (ø)` | |
| [...rpc/protocol/dubbo/telnet/InvokeTelnetHandler.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2347/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL3RlbG5ldC9JbnZva2VUZWxuZXRIYW5kbGVyLmphdmE=) | `54.21% <0%> (-3.62%)` | `13% <0%> (-2%)` | |
| [...he/dubbo/remoting/transport/netty/NettyServer.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2347/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3RyYW5zcG9ydC9uZXR0eS9OZXR0eVNlcnZlci5qYXZh) | `67.85% <0%> (-3.58%)` | `8% <0%> (-1%)` | |
| [.../apache/dubbo/rpc/protocol/dubbo/DubboInvoker.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2347/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0R1YmJvSW52b2tlci5qYXZh) | `68.33% <0%> (-3.34%)` | `11% <0%> (ø)` | |
| [...a/org/apache/dubbo/monitor/dubbo/DubboMonitor.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2347/diff?src=pr&el=tree#diff-ZHViYm8tbW9uaXRvci9kdWJiby1tb25pdG9yLWRlZmF1bHQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL21vbml0b3IvZHViYm8vRHViYm9Nb25pdG9yLmphdmE=) | `87.85% <0%> (-1.87%)` | `15% <0%> (ø)` | |
| [...dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2347/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0NhbGxiYWNrU2VydmljZUNvZGVjLmphdmE=) | `77.2% <0%> (-1.48%)` | `29% <0%> (ø)` | |
| [.../src/main/java/org/apache/dubbo/rpc/RpcStatus.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2347/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JwYy9ScGNTdGF0dXMuamF2YQ==) | `57.89% <0%> (-1.06%)` | `18% <0%> (ø)` | |
| [...apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2347/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0R1YmJvUHJvdG9jb2wuamF2YQ==) | `58.33% <0%> (-0.84%)` | `30% <0%> (-1%)` | |
| ... and [2 more](https://codecov.io/gh/apache/incubator-dubbo/pull/2347/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-dubbo/pull/2347?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-dubbo/pull/2347?src=pr&el=footer). Last update [f720ccb...5a2c7d6](https://codecov.io/gh/apache/incubator-dubbo/pull/2347?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2347 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-dubbo] diecui1202 commented on issue #2347: [Dubbo-2233] fix reference config cache issue #2233

Posted by "diecui1202 (GitHub)" <gi...@apache.org>.
@YoungHu I try to reproduce the problem with the following client code,

```java
        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 ?

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2347 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-dubbo] diecui1202 commented on issue #2347: [Dubbo-2233] fix reference config cache issue #2233

Posted by "diecui1202 (GitHub)" <gi...@apache.org>.
I use the newest master branch, it's ok. Refer to #1999 

So could u please file a new PR?

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2347 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-dubbo] diecui1202 commented on issue #2347: [Dubbo-2233] fix reference config cache issue #2233

Posted by "diecui1202 (GitHub)" <gi...@apache.org>.
@YoungHu My mistake. But the following code can also get the right response.

```java
        // 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 ?

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2347 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-dubbo] YoungHu closed pull request #2347: [Dubbo-2233] fix reference config cache issue #2233

Posted by "YoungHu (GitHub)" <gi...@apache.org>.
[ pull request closed by YoungHu ]

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2347 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org