If the control plane sends MAX_UINT32 as the max_requests for circuit breaking, grpc-java will treat it as a negative number. That should cause circuit breaking to trigger for all RPCs.
To treat it as a uint32, you essentially need to AND it with 0xFFFFFFFFL to make it unsigned. Since this is in xDS, we can use Integer.toUnsignedLong(int) (the main other convenience being Guava's UnsignedInts.toLong(int)).
If the control plane sends MAX_UINT32 as the max_requests for circuit breaking, grpc-java will treat it as a negative number. That should cause circuit breaking to trigger for all RPCs.
max_requests
is aUInt32Value
, but that's encoded as a signedint
in Java. The code casts to long, but the sign is preserved: https://github.com/grpc/grpc-java/blob/4e8f7df589cbe5a192e705ab372f2b27957bf662/xds/src/main/java/io/grpc/xds/XdsClusterResource.java#L216To treat it as a uint32, you essentially need to AND it with 0xFFFFFFFFL to make it unsigned. Since this is in xDS, we can use
Integer.toUnsignedLong(int)
(the main other convenience being Guava'sUnsignedInts.toLong(int)
).b/372943501
CC @kannanjgithub