-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
xds: Circuit breaking doesn't support unsigned 32 bits #11695
Comments
ejona86
pushed a commit
to ejona86/grpc-java
that referenced
this issue
Jan 15, 2025
…pc#11735) Added change for circuit breaking by converting signed 32-bit Int to Unsigned 64-bit Long For MaxRequest negative value ( -1) Fixes grpc#11695
ejona86
pushed a commit
to ejona86/grpc-java
that referenced
this issue
Jan 15, 2025
…pc#11735) Added change for circuit breaking by converting signed 32-bit Int to Unsigned 64-bit Long For MaxRequest negative value ( -1) Fixes grpc#11695
This was referenced Jan 15, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:grpc-java/xds/src/main/java/io/grpc/xds/XdsClusterResource.java
Line 216 in 4e8f7df
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'sUnsignedInts.toLong(int)
).b/372943501
CC @kannanjgithub
The text was updated successfully, but these errors were encountered: