Skip to content

Headers already sent in HttpSys response caching #12194

@sksk571

Description

@sksk571

We are seeing occasional "Headers already sent" errors triggered from the HttpSys code that enables response caching:

ProcessRequestAsync System.InvalidOperationException: Headers already sent.
   at Microsoft.AspNetCore.Server.HttpSys.Response.CheckResponseStarted()
   at Microsoft.AspNetCore.Server.HttpSys.FeatureContext.ConsiderEnablingResponseCache()
   at Microsoft.AspNetCore.Server.HttpSys.FeatureContext.<OnResponseStart>d__131.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.HttpSys.MessagePump.<ProcessRequestAsync>d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Server.HttpSys.MessagePump.<ProcessRequestAsync>d__23.MoveNext()

Metadata

Metadata

Assignees

Labels

affected-fewThis issue impacts only small number of customersarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsbugThis issue describes a behavior which is not expected - a bug.feature-httpsysseverity-minorThis label is used by an internal tool

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions