question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Will Kestrel cancel the request immediately

See original GitHub issue

when 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 Tasks , 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:closed
  • Created 5 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Eiloncommented, Mar 30, 2018

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:

0reactions
aspnet-hellocommented, Jul 11, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

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