grpc go compression not working

165 views
Skip to first unread message

Kartik Singhal

unread,
Mar 14, 2023, 6:00:35 PM3/14/23
to grpc.io
Hi, 

I am trying to compress message at client side with the gzip compressor by adding the following DialOption when getting connection - 
grpc.WithDefaultCallOptions(
grpc.UseCompressor(gzip.Name),
),
 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

unread,
Mar 15, 2023, 1:26:23 PM3/15/23
to Kartik Singhal, grpc.io
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 "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/6f6d8d62-d582-4db1-a075-0f75a352a1ebn%40googlegroups.com.

Kartik Singhal

unread,
Mar 16, 2023, 2:03:07 AM3/16/23
to grpc.io
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
Forward
0 new messages