Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SocketException at client when server throws an exception with a long message #36529

Closed
bhaeussermann opened this issue May 6, 2024 · 2 comments

Comments

@bhaeussermann
Copy link

What version of gRPC and what language are you using?

  • Google.Protobuf 3.26.1
  • Grpc.Net.Client 2.62.0
  • Grpc.Tools 2.63.0

Language: C#

What operating system (Linux, Windows,...) and version?

Windows 11 Enterprise (10.0.22631 Build 22631)

What runtime / compiler are you using (e.g. python version or version of gcc)

.NET 8.0.204

What did you do?

I followed the steps in the Microsoft tutorial for creating a .NET gRPC server and client. I modified the service operation to throw an exception with a long message as follows:

public class GreeterService : Greeter.GreeterBase
{
    public override Task<HelloReply> SayHello(HelloRequest request, ServerCallContext context)
    {
        return Task.FromException<HelloReply>(new Exception(string.Join("", Enumerable.Repeat("soi-", 4100))));
    }
}

I have set MaxSendMessageSize to 10 MB on the server (MaxSendMessageSize = 10_485_760) and also set MaxReceiveMessageSize to 10 MB on the client. This is much larger than the length of the exception message.

If I make the operation return a long response message as in Task.FromResult(new HelloReply { Message = string.Join("", Enumerable.Repeat("soi-", 40000)) }) this works fine. This shows that the exception message isn't exceeding the maximum allowed message size.

What did you expect to see?

The following exception at the client:

Grpc.Core.RpcException: 'Status(StatusCode="Unknown", Detail="Exception was thrown by handler. Exception: soi-soi-soi-soi-soi-soi-soi-soi-soi-soi-soi-soi-soi-soi-soi-...

What did you see instead?

The following exception at the client:

Grpc.Core.RpcException: 'Status(StatusCode="Internal", Detail="Error starting gRPC call. HttpRequestException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR' (0x1). (HttpProtocolError) HttpProtocolException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR' (0x1). (HttpProtocolError)", DebugException="System.Net.Http.HttpRequestException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR' (0x1). (HttpProtocolError)")'
@tonydnewell
Copy link
Contributor

@bhaeussermann This repository is for the legacy gRPC C# implementation.
You are using the newer Grpc.Net.Client so you need to ask this in the https://github.com/grpc/grpc-dotnet/ repository.

@bhaeussermann
Copy link
Author

bhaeussermann commented Jun 5, 2024

Thank you @tonydnewell. I posted the issue there and closed this issue.

@bhaeussermann bhaeussermann closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants