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

[Bug] NPE will occur when consumer lazy init and the consumer thread contextClassLoader is null #14477

Closed
4 tasks done
Xwiam opened this issue Jul 29, 2024 · 2 comments
Closed
4 tasks done
Labels
component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage

Comments

@Xwiam
Copy link
Contributor

Xwiam commented Jul 29, 2024

Pre-check

  • I am sure that all the content I provide is in English.

Search before asking

  • I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

3.2.0

Steps to reproduce this issue

1、consumer lazy init config
dubbo:consumer init=false
2、start your dubbo service
3、use arthas to invoke your dubbo service
you will get the NPE Exception
image

What you expected to happen

the invoke will be ok,not throw NPE Exception

Anything else

No response

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

@Xwiam
Copy link
Contributor Author

Xwiam commented Jul 29, 2024

#14478 (comment)

@Xwiam
Copy link
Contributor Author

Xwiam commented Jul 30, 2024

when mH2i.getSerializerFactory().getClassLoader() is null , the NPE exception will occur

https://github.com/apache/dubbo/blob/3.2/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2ObjectInput.java#L113

public T readObject(Class cls, Type type) throws IOException, ClassNotFoundException {
if (!mH2i.getSerializerFactory().getClassLoader().equals(Thread.currentThread().getContextClassLoader())) {
mH2i.setSerializerFactory(hessian2FactoryManager.getSerializerFactory(Thread.currentThread().getContextClassLoader()));
}
return readObject(cls);
}

@AlbumenJ AlbumenJ closed this as completed Aug 7, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Dubbo Board Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage
Projects
Archived in project
Development

No branches or pull requests

2 participants