Dwiyi
Dwiyi

Reputation: 646

Grpc bi-directional stream was terminated by peer when stream call loop is big?

I have bi directional stream between client (dart) and server (.net). I got problem when client have big stream call loop

on server i get

System.IO.IOException: The request stream was aborted.
---> Microsoft.AspNetCore.Connections.ConnectionAbortedException: The HTTP/2 connection faulted.
  --- End of inner exception stack trace ---
  at System.IO.Pipelines.PipeCompletion.ThrowLatchedException()
  at System.IO.Pipelines.Pipe.GetReadResult(ReadResult& result)
  at System.IO.Pipelines.Pipe.GetReadAsyncResult()
  at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2MessageBody.ReadAsync(CancellationToken cancellationToken)
  at Grpc.AspNetCore.Server.Internal.PipeExtensions.ReadStreamMessageAsync[T](PipeReader input, HttpContextServerCallContext serverCallContext, Func`2 deserializer, CancellationToken cancellationToken)

and on client i get

gRPC Error (code: 2, codeName: UNKNOWN, message: HTTP/2 error: Stream error: Stream was terminated by peer (errorCode: 2)., details: null)

its working when small stream call loop.

i tried to increase MaxStreamsPerConnection but still not working

.ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.ConfigureKestrel(serveroption => {
        
                        serveroption.Limits.Http2.MaxStreamsPerConnection = 5000;
                    }).UseStartup<Startup>();
                });

Upvotes: 1

Views: 1449

Answers (1)

Dwiyi
Dwiyi

Reputation: 646

My app using nginx as reverse proxy. It's turn out to be problem from nginx webserver. the error i get from nginx

client intended to send too large chunked body: 10489464 bytes while sending request to upstream,

to fix this just add

http {
    ...
    client_max_body_size 20M;
}   

Nginx error: client intended to send too large body

Upvotes: 1

Related Questions