Description
With the move from Metadata interface{}
to Attributes *attributes.Attributes
to store custom properties on an address, the technique that most balancers use (including all balancers built using google.golang.org/grpc/balancer/base
) to determine if an address is new or not does not work.
They simply use the resolver.Address
struct as a map key. But a resolver can return the same address with the same custom attributes, but with a different *attributes.Attributes
pointer value. This causes the balancer to think it's a different address and end up churning the connection (e.g. creating a new sub-conn and closing the existing one).
Working around this in a resolver -- returning stable pointer values in the address for identical attribute values -- is a non-trivial implementation burden and attempts to do so could easily lead to inadvertent memory leaks.