Skip to content

Inconsistent behavior in HttpContext.RequestAborted.IsCancellationRequested #35407

@avparuch

Description

@avparuch

Describe the bug

When a client disconnects, I expect HttpContext.RequestAborted.IsCancellationRequested to return true. On Kestrel, this is indeed the case. However on HttpSysServer, HttpContext.RequestAborted.IsCancellationRequested returns false despite the client disconnecting.

To Reproduce

  1. Fire up any Kestrel sample project in Visual Studio: https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/fundamentals/servers/kestrel/samples/5.x/KestrelSample

  2. Fire up any HttpSysServer sample project in Visual Studio: https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/fundamentals/servers/httpsys/samples/3.x/SampleApp

  3. Send requests to both servers and abruptly disconnect your client. I've attached a simple TCPClient I used.
    TCPClient.zip

  4. HttpContext.RequestAborted.IsCancellationRequested returns true on Kestrel, returns false on HttpSysServer.

Further technical details

  • ASP.NET Core version : 5.0.9

Metadata

Metadata

Assignees

Labels

area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-httpsys

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions