tonic icon indicating copy to clipboard operation
tonic copied to clipboard

Limit of 4M on outgoing messages

Open MathieuDutSik opened this issue 1 year ago • 3 comments

Bug Report

There is a limit on ongoing messages sent to a server of 4M that we can see in many different implementations. However, tonic also implements a limitation of 4M on outgoing messages. That limitation is rarer and maybe not justified.

Version

0.11

Platform

Crates

Description

MathieuDutSik avatar Mar 14 '24 20:03 MathieuDutSik

For anyone stumbling upon this, you can set your limits directly on the Grpc type like so:

            let grpc = tonic::client::Grpc::new(svc)
                .max_decoding_message_size(usize::MAX)
                .max_encoding_message_size(usize::MAX);

The question here should be whether there should be a default limit and if so whether it should be 4 MiB.

mladedav avatar Mar 21 '24 11:03 mladedav

The question here should be whether there should be a default limit and if so whether it should be 4 MiB.

I don't know if this is worth having open as an issue to ask. Seems like this is the default for all of the implementations, and its configurable. I vote we just close this.

  • C/C++: https://github.com/grpc/grpc/blob/14d76aac59df4be97adbba1dea93d3d6fe058eed/include/grpc/impl/grpc_types.h#L180
  • C#: https://github.com/grpc/grpc-dotnet/blob/b57c87f2a9897b2046fdf8fff8e9eb5cb5bce396/src/Grpc.Net.Client/GrpcChannel.cs#L44
  • Go: https://github.com/grpc/grpc-go/blob/6d236200ea68ea644d78a164c4ad9952a765aed3/clientconn.go#L96
  • https://github.com/grpc/grpc-java/blob/a28357e197e2085b21683fe89b850c7e91cbe5a3/core/src/main/java/io/grpc/internal/GrpcUtil.java#L211-L214

ajwerner avatar Jun 06 '24 16:06 ajwerner

@ajwerner all links you sent are defaults for received messages. Default for size of outgoing messages is -1 in C/C++ and Math.MaxInt32 in Go, I didn't see similar constants in C# and Java.

For me this issue isn't about the default max size of received messages, but about tonic refusing to send large messages because of this limit.

mladedav avatar Jun 06 '24 18:06 mladedav