Logs filled with critical exceptions from Kestrel/Quic
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
I run an app in a linux docker container (tag 7.0) with http/3 enabled. The libmsquic version in 2.1.4 (from ms repo). The server logs are being filled with the following message:
Microsoft.AspNetCore.Server.Kestrel Critical Unexpected exception in HttpConnection.ProcessRequestsAsync.
An internal error has occurred. StreamShutdown failed: QUIC_STATUS_INVALID_PARAMETER
at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal.QuicStreamContext.Abort(ConnectionAbortedException abortReason)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http3.Http3FrameWriter.Abort(ConnectionAbortedException error)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http3.Http3ControlStream.Abort(ConnectionAbortedException abortReason, Http3ErrorCode errorCode)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http3.Http3Connection.ProcessRequestsAsync[TContext](IHttpApplication`1 application)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.HttpConnection.ProcessRequestsAsync[TContext](IHttpApplication`1 httpApplication)
This doesn’t influence the operations as far as we see. The server responds normally despite the messages.
Expected Behavior
No messages in logs
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
7.0 runtime (no sdk)
Anything else?
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:26 (21 by maintainers)
Top Results From Across the Web
Logging in .NET Core and ASP.NET Core
Learn how to use the logging framework provided by the Microsoft.Extensions.Logging NuGet package.
Read more >c# - Prevent Kestrel from logging errors that are handled in ...
1 Answer. Set context. ExceptionHandled = true; and then Kestrel will know you took care of it and will not log it.
Read more >Don't let ASP.NET Core Console Logging Slow your App down
This is very useful during development as you can see exception information and log your own status information to the console for easy ......
Read more >Setting up Serilog in ASP.NET Core - Detailed Beginner ...
This article covers the implementation of Serilog in ASP.NET Core which provides structured logging that is easier to be read by programs.
Read more >Serilog in ASP.NET Core 3.1 - Structured Logging Made ...
In this article, let's go through Serilog in ASP.NET Core 3.1 and it's implementations. Now by default, ASP.NET Core comes with some basic...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@ManickaP Thanks for that analysis! I can take next steps (which will probably be following up with @JamesNK 😆).
So I found 2 occurrences of
[ api] Exit 2147942487(e.g. INVALID_PARAMETER) in the logs. Both were for an incoming unidirectional stream (control | QPack) and both were due to the layer above (Kestrel) callingAborton an already shutdown stream. What happens is that connection idles out and part of that process is also shutdown of all active streams (with the same cause “Connection Idle”). As control streams are not meant to be closed ever, they are alive at this point and they receive this event. What I suspect causes the error to happen here is that processing of this stream event that eventually removes the stream from_streamscollection: https://github.com/dotnet/aspnetcore/blob/b441d4e816ef3bc43b72e91ba8793f252ada2c5a/src/Servers/Kestrel/Core/src/Internal/Http3/Http3ControlStream.cs#L244 races with connection closure and in some cases the connection is faster and calls abort: https://github.com/dotnet/aspnetcore/blob/b441d4e816ef3bc43b72e91ba8793f252ada2c5a/src/Servers/Kestrel/Core/src/Internal/Http3/Http3Connection.cs#L499-L506@JamesNK Could you look into what I found out? If I’m right, this is not a problem of S.N.Quic.
Details from msquic logs: