grpc go compression not working

Skip to first unread message

Kartik Singhal

Mar 14, 2023, 6:00:35 PM3/14/23

I am trying to compress message at client side with the gzip compressor by adding the following DialOption when getting connection - 
 at the client side.
 At the server side I am just importing the gzip path to register the compressor. When adding the compressor option I am getting error: `rpc error: code = ResourceExhausted desc = grpc: received message after decompression larger than max (11355560 vs. 4194304)`. Although I understand that this might be due to the incoming message size limit at server side which is 4 Mb I am unable to understand why I get the following error when sending the same payload but without adding the UseCompressor DialOption : ` rpc error: code = ResourceExhausted desc = grpc: received message larger than max (11355560 vs. 4194304)`. 

I am confused that why it is showing the message size for both cases when using compression or not. The first error message shows that decompression is done but it is not compressing the data as it is not increased in other request. 

Yuri Golobokov

Mar 15, 2023, 1:26:23 PM3/15/23
to Kartik Singhal,
Hi Kartik,

The message size is checked after decompression. This is why you get similar error messages when sending compressed or uncompressed messages.
Notice the difference:
received message after decompression larger than max
received message larger than max
You received this message because you are subscribed to the Google Groups "" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Kartik Singhal

Mar 16, 2023, 2:03:07 AM3/16/23
Thanks for your response and clarifying. I was under the same impression that it might be checking after decompression but could not understand why it was doing so. 
Reply all
Reply to author
0 new messages