async http handler crashes occasionally on iis7

M

Mark Weaver

I have an asynchronous http handler that crashes on iis7 (on w2k8 x64
or w7 x64) -- I didn't see this behaviour on iis6 (w2k3 x86) where it
was running for around 2 years. It's reasonably reproducible under
load.

Basically the handler is just calling BeginRead() on a file, then
BeginWrite() on HttpResponse.OutputStream, then when finished it calls
the callback passed to BeginProcessRequest. On the odd occasion this
callback throws a NullReferenceException, with the backtrace listed
below. I've logged everything it does to a StringBuilder to check
what it's doing, but I don't see anything other than read/write/finish
-- which is the same as the case where it doesn't crash. google
doesn't show much up for the backtrace.

I assume I'm doing something wrong that trips up iis7, but I can't see
it, any hints? (I have checked that the handler is not completing
synchronously -- the IAsyncResult objects from the BeginRead callback
on the file and the BeginWrite callbacks on the OutputStream all
say .CompletedSynchronously=false).

Thanks,

Mark

backtrace:
System.Web.dll!System.Web.HttpApplication.CurrentModuleContainer.get()
Line 552 + 0x19 bytes C#
System.Web.dll!
System.Web.HttpApplication.PipelineStepManager.ResumeSteps(System.Exception
error) Line 3755 + 0xc bytes C#
System.Web.dll!
System.Web.HttpApplication.ResumeStepsFromThreadPoolThread(System.Exception
error) Line 2270 + 0xd bytes C#
System.Web.dll!
System.Web.HttpApplication.CallHandlerExecutionStep.ResumeStepsWithAssert(System.Exception
error) Line 3302 + 0xf bytes C#
System.Web.dll!
System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(System.IAsyncResult
ar) Line 3298 C#
NPSL.FsCache.dll!
NPSL.FsCache.AsyncResultNoResult.Complete(System.Exception exception =
null, bool completedSynchronously = false) Line 65 + 0x2a bytes C#
NPSL.FilePak.dll!NPSL.FilePak.FilePakHandler.WriteCompleted(object
extraData = {NPSL.FsCache.AsyncResultNoResult}, System.Exception e =
null) Line 80 + 0x1a bytes C#
NPSL.FsCache.dll!
NPSL.FsCache.CachedFile.WriteAsyncInfo.Finish(System.Exception e =
null, string reason = "BeginRead completed: ok") Line 145 + 0x27
bytes C#
NPSL.FsCache.dll!NPSL.FsCache.CachedFile.WriteAsyncInfo.BeginRead()
Line 246 + 0x1c bytes C#
NPSL.FsCache.dll!
NPSL.FsCache.CachedFile.WriteAsyncInfo_OutputWriteCompleted(System.IAsyncResult
ar = {System.Runtime.Remoting.Messaging.AsyncResult}) Line 160 + 0x9
bytes C#
mscorlib.dll!
System.Runtime.Remoting.Messaging.AsyncResult.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage
msg) + 0x168 bytes
mscorlib.dll!
System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage
msg, System.Runtime.Remoting.Messaging.IMessageSink replySink) + 0x33e
bytes
mscorlib.dll!
System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack(object
o) + 0x58 bytes
mscorlib.dll!System.Threading.ExecutionContext.runTryCode(object
userData) + 0x178 bytes
[Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!
System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext
executionContext, System.Threading.ContextCallback callback, object
state) + 0x62 bytes
mscorlib.dll!
System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(System.Threading._ThreadPoolWaitCallback
tpWaitCallBack) + 0x61 bytes
mscorlib.dll!
System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(object
state) + 0x4f bytes
[Appdomain Transition]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top