Will Kestrel cancel the request immediately
See original GitHub issuewhen there are many requrest in the queue, and some user may refresh or stop in the browse when website is slow, if kestrel not cancel the request immediately, that will make site much slower,
I know there is CancelationToken
I can use to cancel the action immediately , but I may not use CancelationToken
everywhere, I know Thread
can Abort()
, but in asp.net core seems there are Task
s , and I don’t know how to cancel a Task
immediately.
so my question is will “kestrel” or “asp.net core’s HttpContext” abort the request immediately when connection reset
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Will Kestrel cancel the request immediately · Issue #3007
No, Kestrel has no way to abort user code. Cancellation is cooperative. If you have long, expensive operations then they should listen to...
Read more >Request draining with ASP.NET Core Kestrel web server
Kestrel tries to drain the request body. Draining the request body means reading and discarding the data without processing it.
Read more >Using CancellationTokens in ASP.NET Core minimal APIs
Users can cancel requests to your web app at any point, by hitting the stop or reload button on your browser. Typically, your...
Read more >Using CancellationTokens in ASP.NET Core MVC controllers
ASP.NET Core provides a mechanism for the web server (e.g. Kestrel) to signal when a request has been cancelled using a CancellationToken ....
Read more >Kestrel + IIS Reverse Proxy RequestAborted Not Triggered
It's a proxy against a mapping server which bails on requests after zoom/pan. Which can result in a huge number of canceled requests...
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
How other systems handle connection resets is not particularly relevant because ASP.NET Core is not any of those systems (and shares almost nothing with any of them).
The idea is that if you already know your code is “safe” for Thread.Abort, you might as well write your code cooperatively anyway (such as by using cancellation tokens).
I found a few links discussing Thread.Abort and how to safely stop code from running:
We periodically close ‘discussion’ issues that have not been updated in a long period of time.
We apologize if this causes any inconvenience. We ask that if you are still encountering an issue, please log a new issue with updated information and we will investigate.