Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for HttpContext.RequestAborted in the HttpTrigger cancellation token #8903

Closed
CasperWSchmidt opened this issue Nov 11, 2022 · 7 comments · Fixed by #9159
Closed

Support for HttpContext.RequestAborted in the HttpTrigger cancellation token #8903

CasperWSchmidt opened this issue Nov 11, 2022 · 7 comments · Fixed by #9159

Comments

@CasperWSchmidt
Copy link

What problem would the feature you're requesting solve? Please describe.

Using Http triggers in Azure Functions is a common use case. Having longer running functions is also quite normal. Therefore I'm actually quite surprised that cancelling a request (fx. in Postman) affect the function running. IMHO that is what developers would expect (at least it's what I did, and what the author did here)

Describe the solution you'd like

Something like what's described here - when the client cancels the http request the Azure Function should be notified through the cancellation token by default

Describe alternatives you've considered

Manually handling the linking of the host cancellation token and HttpContext.RequestAborted as described here

Additional context

None

@miqm
Copy link

miqm commented Feb 23, 2023

Subscribing to topic - this is also a problem with python worker - cancelled http requests can wait for a quite long time and execute long after client drops the connection which can lead ineffectiveness in utilising resources.

@esimkowitz
Copy link

It is super exciting to see this issue being addressed and getting this regression closed! Do you have an ETA for when this will get rolled out to the SDK?

I am also throwing my support behind the idea of linking this to the existing FunctionContext.CancellationToken (from what I gathered from the draft PR, that is the current proposal?). That is the most intuitive approach from a developer standpoint, especially since I imagine a lot of developers already assume that is how this works (I know I did until today!).

@liliankasem
Copy link
Member

It is super exciting to see this issue being addressed and getting this regression closed! Do you have an ETA for when this will get rolled out to the SDK?

I am also throwing my support behind the idea of linking this to the existing FunctionContext.CancellationToken (from what I gathered from the draft PR, that is the current proposal?). That is the most intuitive approach from a developer standpoint, especially since I imagine a lot of developers already assume that is how this works (I know I did until today!).

I think you're commenting about CancellationToken support in the dotnet worker? This is already supported today, that feature went out last year (code). You should be able to bind to the CancellationToken directly or use it via FunctionContext.

The focus of this issue/PR is to also take into account the the RequestAborted cancellation token with the host/platform CancellationToken that we use/handle today. I wouldn't consider it a regression as support for RequestAborted did not exist with in-proc dotnet either.

For RequestAborted support, ETA would be maybe some time next month. PR needs to go through review & testing and when that is merged it could take 3-4 weeks for the release to roll out.

@esimkowitz
Copy link

Got it, that clears things up thank you! Very much looking forward to this going in!

@CasperWSchmidt
Copy link
Author

@liliankasem Do you know when this will be out?

@liliankasem
Copy link
Member

@liliankasem Do you know when this will be out?

Not 100% sure but probably end of April, or whenever 4.20.0 is out.

@esimkowitz
Copy link

@liliankasem Do you know what the status of the rollout here is? What SDK versions do I need to take advantage of this if I'm using out-of-process mode?

@ghost ghost locked as resolved and limited conversation to collaborators Jun 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
6 participants