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

ObjectDisposedException within OwinMiddleWare.Invoke for long-running requests #434

Closed
mitchkeith opened this issue Nov 17, 2021 · 11 comments
Milestone

Comments

@mitchkeith
Copy link

This may be similar to this issue, but I'm not certain it's the same #420

We are seeing an ObjectDisposedException during long-running requests. Our service calls into a number of external services, and there are small number of those external requests that may time out occasionally. Sometimes, we see ObjectDisposedException thrown during that scenario. We are wondering if there is any suggested way to handle this type of scenario. Is there a way to ensure that the HttpListenerObject is not disposed while the request is still active? Should we just catch the exception and check for certain conditions which may imply a downstream request has timed out, and handle it more gracefully?

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListenerResponse'.
at System.Net.HttpListenerResponse.CheckDisposed()
at System.Net.HttpListenerResponse.set_ContentLength64(Int64 value)
at Microsoft.Owin.Host.HttpListener.RequestProcessing.HeadersDictionaryBase.Set(String key, String[] value)
at System.Web.Http.Owin.HttpMessageHandlerAdapter.SendResponseMessageAsync(HttpRequestMessage request, HttpResponseMessage response, IOwinResponse owinResponse, CancellationToken cancellationToken)
at System.Web.Http.Owin.HttpMessageHandlerAdapter.d__0.MoveNext()

@Tratcher
Copy link
Member

This seems related to #430 as well. We realized that client disconnects could cause these ODEs. #432 may have fixed this. That hasn't shipped yet, but you should be able to build the dev branch locally and try it.

@mitchkeith
Copy link
Author

This seems related to #430 as well. We realized that client disconnects could cause these ODEs. #432 may have fixed this. That hasn't shipped yet, but you should be able to build the dev branch locally and try it.

Thanks for the reply. At what time, or in what version, do you estimate the fix will be available? And how can we consume the fix, when it's available? I assume we'll just need to update our Owin packages to the latest version?

@Tratcher
Copy link
Member

It's scheduled for 4.2.1, we're only waiting for the original reporter to verify the fix. If you could build and verify the fix that would also help.

@mitchkeith
Copy link
Author

mitchkeith commented Nov 23, 2021

That makes sense; is there any documentation on how I can build from the development branch into my local application? I can try and see if I can get a local repro of the issue and see if it is resolved when using development branch.

@Tratcher
Copy link
Member

https://github.com/aspnet/AspNetKatana#source-code, you can run build.cmd from the repo root. That should produce an artifacts folder with the packages. You can add that folder as a nuget feed in your project to reference the local build.

@mitchkeith
Copy link
Author

I've been OOF and otherwise busy working on some higher priority work, but may be able to try this out by the end of the week to see if I can get the local repro and validate the fix. I assume the fix hasn't been validated locally yet and it'd still be useful for me to try and do this?

@Tratcher
Copy link
Member

The other customer's validation is ongoing. Any confirmation you can give would also help.

@sablancoleis
Copy link

Hi @Tratcher, do you have an ETA for the new release with this fix?

@Tratcher
Copy link
Member

The customers doing the validation never got back to us. I anticipate shipping the release in a few months for other reasons.

@Tratcher
Copy link
Member

Good news: rolling builds are now available from our new infrastructure. See https://github.com/aspnet/AspNetKatana/blob/main/README.md#signed-rolling-builds

Please try out the new packages, we're hoping to ship this release soon.

@Tratcher
Copy link
Member

Tratcher commented Apr 8, 2022

@Tratcher Tratcher closed this as completed Apr 8, 2022
@Tratcher Tratcher added this to the Discussions milestone Apr 8, 2022
@ghost ghost locked as resolved and limited conversation to collaborators May 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants