question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grpc.AspNetCore ReadStreamMessageAsync - Stack overflow

See original GitHub issue

What version of gRPC and what language are you using?

Grpc.AspNetCore 2.33.1

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

windows 10

What runtime / compiler are you using (e.g. .NET Core SDK version dotnet --info)

.NET Core SDK (reflecting any global.json): Version: 3.1.403 Commit: 9e895200cd

Runtime Environment: OS Name: Windows OS Version: 10.0.19041 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.403\

Host (useful for support): Version: 3.1.9 Commit: 774fc3d6a9

.NET Core SDKs installed: 2.2.207 [C:\Program Files\dotnet\sdk] 3.1.201 [C:\Program Files\dotnet\sdk] 3.1.403 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

What did you do?

Created client Console that send audio samples each N ms using IClientStreamWriter Google.Protobuf Version=“3.13.0” Grpc.Net.Client Version=“2.32.0” Grpc.Tools Version=“2.32.0”

IClientStreamWriter<AudioSample> writeStream = client.SendAudio(metadata).RequestStream;
var audioSampleSource = new AudioSampleSource(commandLineOptions.AudioFilePath);
audioSampleSource.AudioSampleCreated += async (_, audioSample) => await writeStream.WriteAsync(audioSample);

Created grpc server in asp.net core that receives those samples through grpc Grpc.AspNetCore Version=“2.33.1”

SendAudio(IAsyncStreamReader<AudioSample> requestStream, ServerCallContext context)
try 
{
 while (await requestStream.MoveNext(_cancellationTokenSource.Token))
                    AudioSample sample = requestStream.Current;
}
catch (Exception ex)
{ 
}

What did you expect to see?

Forced closing client, server should’ve caught that exception

What did you see instead?

Server crashed, Stack overflow, this happens randomly, from 10 times server client startups, one client closing will cause Stack overflow.

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

info: Grpc.AspNetCore.Server.ServerCallHandler[14]
      Error reading message.
System.IO.IOException: The request stream was aborted.
 ---> Microsoft.AspNetCore.Connections.ConnectionAbortedException: The HTTP/2 connection faulted.
 ---> Microsoft.AspNetCore.Connections.ConnectionResetException: An existing connection was forcibly closed by the remote host.
 ---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs.<GetResult>g__ThrowSocketException|7_0(SocketError e)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs.GetResult()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketConnection.ProcessReceives()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketConnection.DoReceive()
   --- 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.DuplexPipeStream.ReadAsyncInternal(Memory`1 destination, CancellationToken cancellationToken)
   at System.Net.Security.SslStream.<FillBufferAsync>g__InternalFillBufferAsync|215_0[TReadAdapter](TReadAdapter adap, ValueTask`1 task, Int32 min, Int32 initial)
   at System.Net.Security.SslStream.ReadAsyncInternal[TReadAdapter](TReadAdapter adapter, Memory`1 buffer)
   at System.IO.Pipelines.StreamPipeReader.ReadAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.ReadInputAsync()
   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.Http2Connection.ProcessRequestsAsync[TContext](IHttpApplication`1 application)
   --- End of inner exception stack trace ---
   --- 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)
Stack overflow.
Service.exe (process 21560) exited with code -1073741571

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
JamesNKcommented, Nov 19, 2020

No. I looked at the method and I didn’t see anything that could cause it.

0reactions
koderi-dpcommented, Nov 19, 2020

Will close this one until i can reproduce it at some point

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't get gRPC to work on an existing ASP.NET Core project
I'm trying to add gRPC to an existing ASP.NET Core 7 project. It is an older code-base so its not using the modern...
Read more >
Newest 'grpc-dotnet' Questions - Stack Overflow
I'm trying to add gRPC to an existing ASP.NET Core 7 project. It is an older code-base so its not using the modern...
Read more >
Testing ASP.NET Core GRPC applications with ...
GRPC is a framework to create language agnostic, high-performance Remote Procedure Call (RPC) applications. Support to GRPC services was added ...
Read more >
A Deep Dive into Working with gRPC in .NET 6
In this article, I'll look at the basics of gRPC, including how to create a simple service with gRPC in ASP.NET Core application...
Read more >
问答- 腾讯云开发者社区-腾讯云
AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/2 POST http://127.0.0.1:44825/AzureFunctionsRpcMessages.FunctionRpc/EventStream application/grpc ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found