Unexpected exception in TimingPipeFlusher.TimeFlushAsync when using HttpProtocols.Http1AndHttp2

See original GitHub issue

I’m getting a couple dozen “Unexpected exception in TimingPipeFlusher.TimeFlushAsync” exceptions in my logs every day. This happens only when HTTP2 support is enabled in Kestrel.

System.InvalidOperationException: Can't GetResult unless awaiter is completed.
   at System.IO.Pipelines.ThrowHelper.ThrowInvalidOperationException_GetResultNotCompleted()
   at System.IO.Pipelines.Pipe.GetFlushAsyncResult()
   at System.IO.Pipelines.Pipe.DefaultPipeWriter.GetResult(Int16 token)
   at System.Threading.Tasks.ValueTask`1.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.TimingPipeFlusher.TimeFlushAsync(MinDataRate minRate, Int64 count, IHttpOutputAborter outputAborter, CancellationToken cancellationToken)

I can’t seem to trigger it myself. The exceptions occur on a production server.

The app is running in Kubernetes from the mcr.microsoft.com/dotnet/core/aspnet:2.2.3-alpine image.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:29 (23 by maintainers)

github_iconTop GitHub Comments

1reaction
Tratchercommented, May 9, 2019

A wrapper would be just be more overhead, state machines, etc…

Honestly we don’t see many people switch between Http.Sys and Kestrel. They usually switch between IIS and Kestrel. If they’re using Http.Sys it’s for a specific feature not available elsewhere.

1reaction
silmon27commented, Apr 1, 2019

As expected forcing HttpProtocols.Http2 results in the same exception as HttpProtocols.Http1AndHttp2. Also not related to Alpine, same happens with regular image. I will try to enable verbose logging and see if I can find out more.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected exception in TimingPipeFlusher. ...
The exceptions only occur when ListenOptions.Protocols is set to HttpProtocols.Http1AndHttp2, they don't occur when the default HttpProtocols.
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