Changing maximum response size (getting error RESOURCE EXHAUSTED: Compressed gRPC message exceeds maximum size 4194304)

Hi, great work on this library. I’m currently using the scala client and server both generated using this version 0.7.1. I’m occasionally getting errors like this returned from the service:

io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: Compressed gRPC message exceeds maximum size 4194304: 4196022 bytes read

Here’s what it looks like in intelij’s debugger:

So assuming that’s in bytes, that’s a max response size of about 4 mb. It would be great if I could bump that up to about 32 mb. I’ve done some googling but I can’t figure out if this is a setting on the client or server side, and, more importantly, I’m not sure how I’d change it.

Appreciate any tips.

I am not sure if this helps but I just found this while reading the docs. Under the “Streaming service Client Configuration” it mentions changing the maximum size for messages. here is the docs link

Thanks @AkashicSeer. I’m glad you reminded me to post here.

I ended up figuring it out shortly after posting by digging into the underlying grpc-netty client setup.

Here’s how you’d set it to 32 mb using a channel builder override.

val settings = GrpcClientSettings
      .fromConfig(MyService.name)
      .withChannelBuilderOverrides(_.maxInboundMessageSize((32 * 1e6).toInt))
val client = MyServiceClient(settings)

I confirmed it respects the config by setting it to 1mb and making sure it crashed with an error message reflecting the change.

2 Likes

Thanks for posting this I am sure I will run into this problem soon.