Our communication exceeds the default grpc-java limit on the message size:
Caused by: io.grpc.StatusRuntimeException: INTERNAL:
Frame size 4555602 exceeds maximum: 4194304.
If this is normal, increase the maxMessageSize
in the channel/server builder
That limit can be increased, see from https://github.com/grpc/grpc-java/issues/917:
Set maxMessageSize() on the Channel/Server builder.
When trying to implement the fix in our code base, however, it is not clear for me how to do that, as not all Channel
implementations have a maxMessageSize
method.
Our code uses a ManagedChannel
. The setup code looks like this:
ManagedChannel channel =
ManagedChannelBuilder.forAddress(rpcHost, grpcPort)
.usePlaintext(true).build();
CatalogGrpcServiceGrpc.CatalogGrpcServiceBlockingStub stub =
CatalogGrpcServiceGrpc.newBlockingStub(channel);
CatalogRetrieverGrpcServiceAdapter grpcServiceAdapter =
new CatalogRetrieverGrpcServiceAdapter(
stub, metricRegistry);
Maybe I am missing something, but I cannot see how to increase the maximum size for ManagedChannel
. Only the OkHttpChannelBuilder
has it (OkHttpChannelBuilder#maxMessageSize
).
Questions:
- How can I increase the message limit with a
ManagedChannel
? - If it is not possible with
ManagedChannel
, how can I rewrite the code to use another channel implementation that support to increase the default limit?
maxInboundMessageSize
is ignored in my case. Which grpcVersion are you using? – Dichromatic