-
Notifications
You must be signed in to change notification settings - Fork 26.5k
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
getMethodParameter(java.lang.String, java.lang.String, java.lang.String)并发修改导致空指针异常 #9086
Comments
I think I can solve it.Please assign it to me. |
期待您的回复,隔壁老王同学 |
@Holmesus 能不能提供一个可以重现的测试用例呢??就像MetadataInfoTest里面的方法一样 |
@Holmesus 我想用CAS能解决这个问题。或者两个if判断 |
这个不太好复现,我用多线程只复现了一次,是通过修改MetadataInfo的源码稳定重现的,把MetadataInfo复制一份放在IDE中,用sleep让后来的线程先执行后续的代码 |
@neighbor-uncleWang |
@CrazyHZM I can fix it. |
|
This issue has been completely fixed in the latest 3.x release. |
Environment
org.apache.dubbo.metadata.MetadataInfo.ServiceInfo#getMethodParameter(java.lang.String, java.lang.String, java.lang.String)
Steps to reproduce this issue
出问题的代码
if (methodParams == null) {
methodParams = URL.toMethodParameters(params);
consumerMethodParams = URL.toMethodParameters(consumerParams);
}
修改为
Map<String, Map<String, String>> temp = methodParams;
if (methodParams == null) {
methodParams = URL.toMethodParameters(params);
if(temp == null){
try {
Thread.sleep(1000*3);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
consumerMethodParams = URL.toMethodParameters(consumerParams);
}
Expected Behavior
正常执行
Actual Behavior
由于methodParams已经不为空,consumerMethodParams没有被初始化,执行到342行代码时发生空指针
The text was updated successfully, but these errors were encountered: