Skip to content

Raise client gRPC message cap to 128 MiB#51

Closed
jnathangreeg wants to merge 1 commit into
mainfrom
chore/grpc-msg-size-128mib
Closed

Raise client gRPC message cap to 128 MiB#51
jnathangreeg wants to merge 1 commit into
mainfrom
chore/grpc-msg-size-128mib

Conversation

@jnathangreeg
Copy link
Copy Markdown
Contributor

@jnathangreeg jnathangreeg commented May 13, 2026

Summary

  • Adds maxGRPCMessageSize = 128 << 20 constant in pkg/client/v1/storageclient.go.
  • Applies grpc.MaxCallRecvMsgSize / grpc.MaxCallSendMsgSize via grpc.WithDefaultCallOptions in Connect().

Why

grpc-go defaults the receive cap to 4 MiB on both peers. Larger unary downloads (GetProfile, GetContainerProfile, GetApplicationProfile, etc.) fail at the client with ResourceExhausted: received message larger than max. Raising the client cap to 128 MiB lets those downloads complete.

Note: this is the client-side half. The storage server's own MaxRecvMsgSize must also be raised for large unary uploads to succeed — a companion change is going out on the cadashboardbe side.

Streaming RPCs (PutSBOMStream, GetSBOMStream, SendContainerProfileStream, GetContainerProfileStream) are unaffected; chunks remain 1 MiB.

Test plan

  • Existing unit tests pass (go test ./pkg/client/v1/...).
  • Integration: with the matching server-side change deployed, exercise GetContainerProfile with a >4 MiB profile and confirm it no longer returns ResourceExhausted.

Summary by CodeRabbit

  • Bug Fixes
    • Storage client now supports larger message sizes (up to 128 MiB) for improved data transfer capability.

Review Change Stack

- Introduced maxGRPCMessageSize constant to set a higher limit for both send and receive operations, allowing larger payloads for unary RPCs.
- Updated Connect method to apply the new message size limits in gRPC call options.

This change improves the capability of the StorageClient to handle larger data transfers effectively.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

📝 Walkthrough

Walkthrough

This PR increases gRPC message size limits in the storage client. A new constant maxGRPCMessageSize set to 128 MiB is defined and applied to both receive and send message caps in StorageClient.Connect via grpc.WithDefaultCallOptions. The SBOM streaming chunk size comment is also clarified.

Changes

gRPC Message Size Limits

Layer / File(s) Summary
gRPC message size constant and Connect integration
pkg/client/v1/storageclient.go
Defines maxGRPCMessageSize constant at 128 MiB and applies it to StorageClient.Connect via grpc.WithDefaultCallOptions for both receive and send message caps.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through gRPC lanes,
"128 megs!" the message cries,
No more cramped chat, no more pains,
Send and receive with plenty size! 🐰🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: raising the client-side gRPC message size limit to 128 MiB, which is the core objective of this pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/grpc-msg-size-128mib

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
pkg/client/v1/storageclient.go (1)

263-267: ⚡ Quick win

Update deprecation comments to reflect new 128 MiB limit.

The deprecation comments for SendContainerProfile (lines 263-267) and GetContainerProfile (lines 492-496) state that unary methods are "capped at gRPC's default 4 MiB message size." With this PR raising the client limit to 128 MiB, these comments are now misleading.

Consider updating them to:

  • Clarify that the client now supports up to 128 MiB for unary RPCs (when the server is also configured)
  • Retain the recommendation to use streaming for very large profiles, but adjust the threshold or rationale
  • Or simply note that streaming is preferred for arbitrarily large payloads without mentioning a specific cap
📝 Proposed update for deprecation comments

For SendContainerProfile (lines 263-267):

 // SendContainerProfile sends a container profile to the storage server.
 //
 // Deprecated: use SendContainerProfileStream. The unary form is silently
-// capped at gRPC's default 4 MiB message size; profiles with many or
-// large entries can exceed this and fail on the wire. The streaming
-// variant has no such bound.
+// capped at the configured gRPC message size (128 MiB); very large profiles
+// can exceed this and fail on the wire. The streaming variant has no such
+// bound and is preferred for arbitrarily large payloads.

For GetContainerProfile (lines 492-496):

 // GetContainerProfile retrieves a ContainerProfile from the storage server.
 //
 // Deprecated: use GetContainerProfileStream. The unary form goes through
-// GetProfile, which is capped at gRPC's default 4 MiB message size;
-// profiles with many or large entries can exceed this and fail on the
-// wire. The streaming variant has no such bound.
+// GetProfile, which is capped at the configured gRPC message size (128 MiB);
+// very large profiles can exceed this and fail on the wire. The streaming
+// variant has no such bound and is preferred for arbitrarily large payloads.

Also applies to: 492-496

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/client/v1/storageclient.go` around lines 263 - 267, The deprecation
comments for SendContainerProfile and GetContainerProfile still say unary RPCs
are "capped at gRPC's default 4 MiB", which is no longer true; update the doc
comments on the SendContainerProfile and GetContainerProfile methods to either
state the client now supports up to 128 MiB for unary calls (when the server is
likewise configured) and recommend streaming only for larger/very large
profiles, or remove the 4 MiB figure and instead state that streaming is
preferred for arbitrarily large payloads; ensure you reference the method names
SendContainerProfile and GetContainerProfile in the updated comments so readers
can find them.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/client/v1/storageclient.go`:
- Around line 263-267: The deprecation comments for SendContainerProfile and
GetContainerProfile still say unary RPCs are "capped at gRPC's default 4 MiB",
which is no longer true; update the doc comments on the SendContainerProfile and
GetContainerProfile methods to either state the client now supports up to 128
MiB for unary calls (when the server is likewise configured) and recommend
streaming only for larger/very large profiles, or remove the 4 MiB figure and
instead state that streaming is preferred for arbitrarily large payloads; ensure
you reference the method names SendContainerProfile and GetContainerProfile in
the updated comments so readers can find them.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: eaf8d2b0-7f88-4bce-b180-7af2583e3cce

📥 Commits

Reviewing files that changed from the base of the PR and between 0b223ab and 93aaff1.

📒 Files selected for processing (1)
  • pkg/client/v1/storageclient.go

@matthyx matthyx moved this to To Archive in KS PRs tracking May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants