-
Notifications
You must be signed in to change notification settings - Fork 334
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
System.ObjectDisposedException exception in OwinHttpListener.ProcessRequestsAsync() #420
Comments
That's problematic. I agree it's probably the call to Response.Abort that puts the response in an unexpected state and later triggers the ODE on this call stack. Can you share more about why you're aborting the response? The main logic conflict is here: AspNetKatana/src/Microsoft.Owin.Host.HttpListener/RequestProcessing/OwinHttpListenerResponse.cs Lines 298 to 304 in d196e78
OwinHttpListenerResponse thinks the response is still active and that it can set an error status code, but HttpListenerResponse disagrees. The simplest workaround seems to be setting your own error response and calling Flush on the response body to send it, and then throw an exception from your app for the server to catch and abort the response. AspNetKatana/src/Microsoft.Owin.Host.HttpListener/OwinHttpListener.cs Lines 261 to 269 in d196e78
|
Thanks Tratcher. The reason for introducing abort was that we have to terminate our connection with LoadBalancer when we can no longer process requests (something else in the system tells us to stop processing requests). Just informing the LoadBalancer does not terminate the connection and the only way to terminate the connection for sure was to Abort the connection. |
The load balancer doesn't respect an HTTP/1.x |
Based on our investigation didn't seem to. The connection continued to remain open. I might have to look into this again and see if there is a gap. In the meantime, will also try the earlier option of setting response and throwing an exception. |
We are sending "Connection: close", however any existing connections were not being closed by the Client (here we are not sure if the client is a .NET Client/ Java client/other). LB we know does not close any existing connections. As a workaround, we wanted to forcibly close the connection from the service side and seems like we used an earlier thread to use the Abort() option. https://stackoverflow.com/questions/61995209/how-to-close-a-tcp-connection-of-the-http-request-from-self-hosted-owin-server-i. Turns out this has unexpected side-effect so will try the new option suggested earlier on this thread. |
Using RuntimeVersion: v4.0.30319 for Microsoft.Owin, Microsoft.Owin.Host.HttpListener and Microsoft.Owin.Hosting.
We are seeing an objectdisposedexception in Owin that is causing a process crash with the following call stack
We suspect 2 places that might be triggering this:
We are suspecting #2 as more likely the reason but not sure how to not make Owin crash? Any suggestions?
The text was updated successfully, but these errors were encountered: