Skip to content
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

Closed
ejona86 opened this issue Nov 14, 2024 · 0 comments · Fixed by #11735
Closed

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

ejona86 opened this issue Nov 14, 2024 · 0 comments · Fixed by #11735
Labels
Milestone

Comments

@ejona86
Copy link
Member

ejona86 commented Nov 14, 2024

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

@ejona86 ejona86 added the bug label Nov 14, 2024
@ejona86 ejona86 added this to the Next milestone Nov 14, 2024
@ejona86 ejona86 modified the milestones: Next, 1.70 Dec 17, 2024
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
ejona86 pushed a commit that referenced this issue Jan 15, 2025
…1735)

Added change for circuit breaking by converting signed 32-bit Int to Unsigned 64-bit Long For MaxRequest negative value ( -1)

Fixes #11695
ejona86 pushed a commit that referenced this issue Jan 15, 2025
…1735)

Added change for circuit breaking by converting signed 32-bit Int to Unsigned 64-bit Long For MaxRequest negative value ( -1)

Fixes #11695
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant