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

rls: fix routeLookupClient may be null in RlsLoadBalancer.requestConnection() #8379

Merged
merged 2 commits into from Aug 10, 2021

Conversation

skyguard1
Copy link
Contributor

@skyguard1 skyguard1 commented Aug 4, 2021

ClusterState.result may be null in CdsLoadBalancer2,can add not-null check to result to avoid NullPointerException, thanks

routeLookupClient may be null in RlsLoadBalancer.requestConnection()

@skyguard1 skyguard1 changed the title fix ClusterState.result may be null in CdsLoadBalancer2 xds: fix ClusterState.result may be null in CdsLoadBalancer2 Aug 4, 2021
@@ -185,7 +185,7 @@ private void handleClusterDiscovered() {
}
LoadBalancerProvider lbProvider = null;
Object lbConfig = null;
if (root.result.lbPolicy() == LbPolicy.RING_HASH) {
if (root.result != null && root.result.lbPolicy() == LbPolicy.RING_HASH) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If root.result is null, then because of the above code, the queue is immediately emptied and instances is also empty, and because instances is empty, the code won't reach here.

@skyguard1
Copy link
Contributor Author

Ok, how about this?routeLookupClient may be null in RlsLoadBalancer.requestConnection()

@skyguard1 skyguard1 changed the title xds: fix ClusterState.result may be null in CdsLoadBalancer2 rls: fix routeLookupClient may be null in RlsLoadBalancer.requestConnection() Aug 6, 2021
@dapengzhang0 dapengzhang0 added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Aug 6, 2021
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Aug 6, 2021
@dapengzhang0
Copy link
Member

Ok, how about this?routeLookupClient may be null in RlsLoadBalancer.requestConnection()

@skyguard1 You did find a bug. Thanks!

@skyguard1
Copy link
Contributor Author

@dapengzhang0 It is my pleasure

@dapengzhang0 dapengzhang0 added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Aug 7, 2021
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Aug 9, 2021
@skyguard1
Copy link
Contributor Author

@dapengzhang0 Thanks

@dapengzhang0 dapengzhang0 merged commit 96a5c25 into grpc:master Aug 10, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants