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
Fix occure the NPE when SpringMVC and hystrix work together #1256
Conversation
8f5e2f1
to
4a1846d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@candyleer could you verify this pr? I think you have some cases.
ok,I will test in last case |
@ascrutae I have tested in my case,but it also has NPE this method will be invoked twice ,and sencond one will throw NPE, and they are in the same thread NPE
|
maybe you can modify like this? @Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
Object ret) throws Throwable {
if (ret instanceof EnhancedInstance && objInst instanceof InvocableHandlerMethod) {
ContextManager.getRuntimeContext().put(REQUEST_KEY_IN_RUNTIME_CONTEXT, ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest());
ContextManager.getRuntimeContext().put(RESPONSE_KEY_IN_RUNTIME_CONTEXT, ((NativeWebRequest)objInst.getSkyWalkingDynamicField()).getNativeResponse());
}
return ret;
} |
4a1846d
to
87fd2fc
Compare
87fd2fc
to
82696ca
Compare
I had fix this. maybe you can try |
Here is the test report |
Thanks. Continue to wait for @candyleer feedback. :) |
Please answer these questions before submitting pull request
Why submit this pull request?
Bug fix
New feature provided
Improve performance
Related issues
NPE when use hystrix in spring #1238