Home > Enterprise >  gRPC message exceeds maximum size 4194304: 5145024
gRPC message exceeds maximum size 4194304: 5145024

Time:01-26

On grpc client I am getting this error after calling the rpc method in server. I am using grpc-spring-boot-starter (java). Please tell me how to increase response size.

        at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:262)
        at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:243)
        at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:156)

CodePudding user response:

  • If you are using official grpc library then create client in following way.
ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 9089).usePlaintext().maxInboundMessageSize(Integer.MAX_VALUE).build();

productsBlockingStub prodStub = productsGrpc.newBlockingStub(channel);

You can refer the grpc project here. Just add modification formaxInboundMessageSize

  • If you are using grpc-client-spring-boot-starter then you can either.
@GrpcClient("greeting-service")
    private GreetingServiceGrpc.GreetingServiceBlockingStub greetingServiceBlockingStub;

    greetingServiceBlockingStub = greetingServiceBlockingStub.withMaxInboundMessageSize(Integer.MAX_VALUE);
    greetingServiceBlockingStub = greetingServiceBlockingStub.withMaxOutboundMessageSize(Integer.MAX_VALUE);

Or add this in props.

grpc.client.greeting-service.max-inbound-message-size=9155241000
grpc.client.greeting-service.package-max-inbound-message-size=9155241000
grpc.client.greeting-service.server.max-inbound-message-size=9155241000
  • Related