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

RegistryProtocol的doOverrideIfNecessary方法里exporter.getInvoker()在实际应用场景下会不会是null #8765

Closed
zrlw opened this issue Sep 10, 2021 · 2 comments

Comments

@zrlw
Copy link
Contributor

zrlw commented Sep 10, 2021

Environment

master分支github构建日志显示ReferenceConfigTest测试方法testReferenceRetry() line 135出现NPE,

        try {
            System.setProperty("java.net.preferIPv4Stack", "true");
            sc.export();  // line 135:  NPE occurred here !!!
            demoService = rc.get();
            success = true;
        } catch (Exception e) {
            e.printStackTrace();
        } finally {

在RegistryProtocol.doOverrideIfNecessary() 691行设置断点:

URL currentUrl = exporter.getInvoker().getUrl();

跟踪testReferenceRetry测试方法发现exporter.getInvoker()返回为null,提交了一个修复PR #8683 (for master), #8768 (for 3.0),这个异常不会影响测试执行流程,因为调用方法FailbackRegistry.notify()捕获异常后只是输出error日志。

当前3.0分支ReferenceConfigTest测试方法testReferenceRetry() 改用InjvmProtocol.getInjvmProtocol().export(...),不会再调用RegistryProtocol了,所以虽然3.0的RegistryProtocol取currentUrl的方法和master相同,都是exporter.getInvoker().getUrl(),但构建日志里并不会出现这个NPE。

不清楚实际应用场景下是否有master分支的这个测试场景, 这个问题有必要做修复么?

@CrazyHZM
Copy link
Member

You can write a test for this scenario to verify whether there is a problem with the 3.0 branch.

@zrlw
Copy link
Contributor Author

zrlw commented Sep 17, 2021

You can write a test for this scenario to verify whether there is a problem with the 3.0 branch.

yes, i add test2ReferenceRetry() in #8768 and NPE will be thrown with 3.0.

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