grpc-swift icon indicating copy to clipboard operation
grpc-swift copied to clipboard

grpc: received message larger than max (9014796 vs. 4194304)

Open Amit011121 opened this issue 3 years ago • 6 comments

Help me with this grpc: received message larger than max (9014796 vs. 4194304).

-- which property should i use to set the (X * 1024 * 1024) message size.

Amit011121 avatar Oct 31 '22 12:10 Amit011121

The error message for this type of error is different in grpc-swift, it looks like it comes from http://github.com/grpc/grpc. The option should be something like 'maxReceiveMessageLength'.

glbrntt avatar Oct 31 '22 12:10 glbrntt

Hey glbrntt thanks for the quick reply there is no such maxReceiveMessageLength property in grpc-swift.

Amit011121 avatar Oct 31 '22 12:10 Amit011121

This error doesn't come from grpc-swift. It looks like it comes from http://github.com/grpc/grpc.

I suspect the server is throwing this error and sending it back as the status to the client which is where you are seeing it. This needs configuring on the server, not the client.

glbrntt avatar Oct 31 '22 13:10 glbrntt

Hi

We found that there is one property available in Objective C i.e #define GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH "grpc.max_receive_message_length" but I am not able to use it in the Swift. I tried searching it in the pod but this property is not defined. As per the docs available we found that this property needs to be set when we are creating the channel request, but at my side I am not able to access that property. Can you please let me know what needs to be done here.

How can we manage this at client side?

Amit011121 avatar Nov 02 '22 06:11 Amit011121

I'll try to be as clear as I can here:

grpc: received message larger than max (9014796 vs. 4194304).

  • This error is not produced by any part of this library.
  • Nothing you configure in this library will make that error go away.

As previously stated the error comes from grpc/grpc.


If you are using this library as a client and seeing this error then it can only come from the status which is sent by the server at the end of every RPC.

This means the server is complaining about the message being too large. Therefore the client has sent a message which is too large for the server to receive.

To resolve this you have two options:

  1. Send smaller messages from the client.
  2. Configure the server (if you manage it) to allow larger messages to be received.

glbrntt avatar Nov 02 '22 09:11 glbrntt