-
Notifications
You must be signed in to change notification settings - Fork 184
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
ObjectDisposedException: Request has finished and HttpContext disposed. in Extensions.Http.AspNetCore #2417
Comments
Can you share what you have and what you're currently doing? Even if it's random it would be helpful to have some steps that could help us figure out what is causing this. |
csproj file:
Trimmed down function raising object desposed function:
Behind the scenes some other api's are being called. They can be slow, but we could not correlate duration vs ObjectDisposedexception. |
Hi , I got the similar exception,
when we can expect the issue fix ? and is there any short term solution or workaround for this issue |
@Rihab8 We removed the dependencies to Asp.net, depending on your functions this is a viable solution or not. |
Same issue exists in Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore version 1.3.2 |
Sorry for the delay here, we're actively investigating a couple of issues that lead to this exception. We suspect that it's a symptom of the platform abruptly shutting down an instance. Is anyone still actively seeing this issue able to share the following info for me to check logs and investigate further?
|
Hi Lilian. Thanks for looking into this issue. |
Hi Lilian, Event time: 04/11/2024, 10:28:42.2521087 (Local time) - we're in GMT, so this happens to be == UTC, anyway |
Thanks for sharing these apps. App 1@pmerineau Looking into your app, I didn't see a I did look into the specific invocation you shared, and it looks like a cancellation related problem. Your invocation is being cancelled (likely due to client disconnect)
And your function invocation is failing, likely due to this proxy that is not forwarding the cancellation request to your app properly:
If this is the issue you're trying to raise, please create a new GH issue as it is not related to this one. Thanks! App 2@stuartf-aida I also looked into your app. I was able to find an
This error occurs during shut down (a graceful host shutdown) and is just noise with no real impact to your application. Nonetheless, we will still look into how to avoid this exception during the shutdown process. Thanks for sharing! I also looked at the specific invocation you shared, you are experiencing the exact same problem as App 1, your invocation was cancelled leading to invocation failure with the same error:
This is also not related to this specific GH issue so please open a new issue (or perhaps add on to one that @pmerineau creates?). The error is actually happening on the Functions Host side in the RetryProxyHandler so I would suggest opening the issue in the host repo and I will continue that investigation there as well. |
Thanks again @liliankasem fyi @pmerineau |
Hi @liliankasem, Event time: 2024-11-05T01:08:31.2502213Z |
This one is also the same cancellation issue:
|
Thanks @liliankasem Event time: 2024-11-05T21:52:17.8987792Z |
Quick update, I was able to find the root cause of the bug here (write up available in this issue). I will work with the team on a solution for this and let folks know when it is resolved.
|
Description
When using the Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore version 1.2.1 we sometimes receive an ObjectDisposedException resulting in a System.InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
Here is the stack trace of the ObjectDisposedException
This file hase already been changed, so line numbers are wrong. https://github.com/Azure/azure-functions-dotnet-worker/pull/2322/files/6149e16e951188e97bf7fcff6918b45ae233bde4#diff-dc49550c24c24c88566ae78776b0400d415dfc8d1a5d623571903671a953e715
The GetRouteData call in now on line 72 instead of 54.
We don't have a reproducible sample as this exception did only happens seemingly random.
As a quick fix we removed AspNetCore package from our function.
Steps to reproduce
Only saw it on a deployed linux azure function with a single instance.
The text was updated successfully, but these errors were encountered: