Skip to content

Java SDK doesn't respect Dapr sidecar max-body-size configuration for large gRPC messages #1410

@MyMirelHub

Description

@MyMirelHub

Expected Behavior

When using the dapr.io/max-body-size: 16Mi annotation on a Kubernetes deployment, the Dapr Java SDK should be able to handle gRPC messages up to the configured size limit (16MB in this case) when downloading files through bindings.

Actual Behavior

Despite setting dapr.io/max-body-size: 16Mi in the pod annotations and confirming it's applied to the sidecar (--max-body-size 16Mi in daprd container args), the Java SDK fails with:

RESOURCE_EXHAUSTED: gRPC message exceeds maximum size 4194304: 10485765

The error occurs when trying to download a 10MB file from Google Cloud Storage using the GCS binding through the Dapr Java SDK. The default gRPC message size limit of 4MB is being enforced by the client, ignoring the sidecar's configured 16MB limit.

Steps to Reproduce the Problem

  1. Create a Kubernetes deployment with Dapr sidecar enabled

  2. Set dapr.io/max-body-size annotation on Kubernetes deployment with a value larger than 4MB

  3. Configure GCS Binding Compnent

  4. Use Java SDK to download file >4MB via GCS binding:

DaprClient client = new DaprClientBuilder().build();
Map<String, String> meta = new HashMap<>();
meta.put("key", "large-file-10mb.bin");
InvokeBindingRequest req = new InvokeBindingRequest("gcs-binding", "get");
req.setMetadata(meta);
var response = client.invokeBinding(req).block(); // Fails here
  1. The operation fails with RESOURCE_EXHAUSTED error

Possible Root Cause

The issue is in the Java SDK's NetworkUtils.java where gRPC channel builder is missing these parameters:

  • builder.maxInboundMessageSize()
  • builder.maxInboundMetadataSize()

https://github.com/dapr/java-sdk/blob/master/sdk/src/main/java/io/dapr/utils/NetworkUtils.java#L169

Release Note

RELEASE NOTE:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions