Skip to content

xds: Circuit breaking doesn't support unsigned 32 bits #11695

Closed
@ejona86

Description

@ejona86

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 a UInt32Value, but that's encoded as a signed int in Java. The code casts to long, but the sign is preserved:

maxConcurrentRequests = (long) threshold.getMaxRequests().getValue();

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)).

b/372943501

CC @kannanjgithub

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions