Last post Dec 21, 2011 11:25 AM by amit.metkar
Nov 29, 2011 11:45 AM|amit.metkar|LINK
I'm using IHttpAsyncHandler to handled the request from user, after the operation OR on specific action I'm trying to close the http connection using following code,
asyncOperation.IsCompleted = true;
It works fine, once in the approximately 1000 request (not always & not frequent), it throws a null reference exception which is handled, but from the same code it throws another unhandled exception from threadpool, which cause app pool recycle
Unhandled Exception Occured, Exception Recd Msg:Object reference not set to an instance of an object.
at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
at System.Web.HttpApplication.ResumeStepsWaitCallback(Object error)
at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
Any idea about this exception & solution for this, help/suggestions appreciated.
Dec 09, 2011 11:14 PM|rstrahl|LINK
You probably want to set .IsCompleted AFTER the callback. If you do it before the Context objects might go away and if your code is accessing those Context objects will be arbitrarily null (removed).
+++ Rick ---
Dec 21, 2011 11:25 AM|amit.metkar|LINK
Thanks Rick for Reply, I will test it, & will share my findings,
I have a question though, How it works most of the time, & cause unhandled exception in some cases. We have 12 servers in the Farm, 1000+ users connected to each server node, and it happens once in a day on one/two of the 12 servers.
highly appreciated your interest in this thread.