1

I am currently facing a damn weird problem on our production servers. Every now and then the default application pool crashes on the iis. After hours of investigating a finally isolated the problem and created a few lines of codes which reliably reproduces the problem:

public class DemoHttpHandler: IHttpHandler {
  public void ProcessRequest (HttpContext Context) {
    try {
      Context.Response.End();
    }
    catch(ThreadAbortException) {
    }
    finally {

    }
  }
}

This sequence causes the following error:

An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/1/ROOT/scs-testint

Process ID: 4752

Exception: System.Threading.ThreadAbortException

Message: Thread was being aborted.

StackTrace:    at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)

Leading to this error:

    Faulting application name: w3wp.exe, version: 8.5.9600.16384, time stamp: 0x5215df96
    Faulting module name: KERNELBASE.dll, version: 6.3.9600.17415, time stamp: 0x54505737
    Exception code: 0xe0434352
    Fault offset: 0x0000000000008b9c
    Faulting process id: 0x1290
    Faulting application start time: 0x01d125da7b0fc43e
    Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
    Faulting module path: C:\Windows\system32\KERNELBASE.dll
    Report Id: b9b1e16f-91cd-11e5-80db-00155d3c110b
    Faulting package full name: 
    Faulting package-relative application ID: 

If I remove the EMPTY??? finally block, everything works fine and the IIS doesn't crash anymore...

public class DemoHttpHandler: IHttpHandler {
  public void ProcessRequest (HttpContext Context) {
    try {
      Context.Response.End();
    }
    catch(ThreadAbortException) {
    }
  }
}

Any ideas?

Silverdust
  • 1,503
  • 14
  • 26
  • Possible duplicate of [Thread.Abort in ASP.NET app causes w3wp.exe to crash](http://stackoverflow.com/questions/32335020/thread-abort-in-asp-net-app-causes-w3wp-exe-to-crash) – stuartd Nov 23 '15 at 11:29
  • Related: [Is Response.End() considered harmful?](http://stackoverflow.com/questions/1087777/is-response-end-considered-harmful) – Tim Schmelter Nov 23 '15 at 11:31
  • 1
    @Silverdust: Were you able to find the reason for the crash? I am seeing a similar issue in my prod servers. Any workarounds? – Turbo May 09 '17 at 23:02

0 Answers0