gRPC Java version 1.60.0
What is your environment?
This fails on all our environments, Linux, MacOS etc
What did you expect to see?
We expect the load balancer to work with a single EquivalentAddressGroup containing multiple addresses.
What did you see instead?
In our client code we receive a Runtime io.grpc.StatusRuntimeException: INTERNAL: Panic! This is a bug!
After debugging the client we tracked it down to this code in the MultiChildLoadBalancer.Endpoint constructor
public Endpoint(EquivalentAddressGroup eag) {
checkNotNull(eag, "eag");
addrs = new String[eag.getAddresses().size()];
int i = 0;
for (SocketAddress address : eag.getAddresses()) {
addrs[i] = address.toString();
}
Arrays.sort(addrs);
hashCode = Arrays.hashCode(addrs);
}
You can see that the code iterates over the addresses in the eag and adds the toString() of each to the string array. But it does not increment the index i so all addresses go to the first array element, the rest are null. This throws an NPE when Arrays.sort() is called.
I assume it should be a trivial fix like addrs[i++] = address.toString();