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

ReferenceConfigCache doesn't work well when no provider #2233

Closed
2 tasks done
YoungHu opened this issue Aug 13, 2018 · 6 comments
Closed
2 tasks done

ReferenceConfigCache doesn't work well when no provider #2233

YoungHu opened this issue Aug 13, 2018 · 6 comments

Comments

@YoungHu
Copy link
Contributor

YoungHu commented Aug 13, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.6.2 and lower
  • Operating System version: all version
  • Java version: all version

Step to reproduce this issue

  1. shutdown provider
  2. consumer side use ReferenceConfigCache.get() to invoke provider
  3. invoke provider one time
  4. startup provider
  5. invoker provider again

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

when provider startup, the second time invoke should success.

Actual Result

second time invoke failed

What cause it

When no provider, config.get() return null, at this time we shouldn't store this reference into cache.

public <T> T get(ReferenceConfig<T> referenceConfig) {
        String key = generator.generateKey(referenceConfig);

        ReferenceConfig<?> config = cache.get(key);
        if (config != null) {
            return (T) config.get();
        }

        cache.putIfAbsent(key, referenceConfig);
        config = cache.get(key);
        return (T) config.get();
    }
@diecui1202
Copy link

@YoungHu Could u please send a PR to solve this problem ?

@YoungHu
Copy link
Contributor Author

YoungHu commented Aug 29, 2018

PR already done

@diecui1202
Copy link

The same issue: #1765 . But it's not ReferenceConfigCache's problem.

I think we need to fix it like #1999

@diecui1202
Copy link

@YoungHu Could u refer to #1999 and fix it on dubbo-2.6.x ?

@YoungHu
Copy link
Contributor Author

YoungHu commented Aug 30, 2018

will check it tomorrow by using the master branch code

@YoungHu
Copy link
Contributor Author

YoungHu commented Aug 31, 2018

confirmed this issue fix at master branch with #1999 ,close this one

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

2 participants