Microsoft KB Archive/917069

= An ASP.NET application may experience delays if a request times out when the application invokes in-process COM+ components =

Article ID: 917069

Article Last Modified on 12/5/2007

-

APPLIES TO


 * Microsoft COM+ 1.5
 * Microsoft ASP.NET 1.0
 * Microsoft ASP.NET 1.1
 * Microsoft ASP.NET 2.0

-





SYMPTOMS
Consider the following scenario. A Microsoft ASP.NET application invokes in-process Microsoft COM+ components. The request times out at the precise moment as certain operations occur in a COM+ component. In this scenario, the COM+ runtime may report a fault to the Windows Error Reporting subsystem. Then, Windows Error Reporting may take actions that can cause additional delays in the application and compound the underlying problem. When you view the System log in Event Viewer, you may notice an event that resembles the following: COM+ Event ID: 4768

Event Type: Error

Event Source: COM+

Event Category: Unknown Event

ID: 4786

Description: The system has called a custom component and that component has failed and generated an exception. This indicates a problem with the custom component. Notify the developer of this component that a failure has occurred and provide them with the information below.

Method Name: IObjectControl::Deactivate

Exception: E0434F4D

Address: 0x77E649D3

Call Stack:

kernel32!RaiseException + 0x48

mscorsvr!CoEEShutDownCOM + 0xe448

mscorsvr!CoEEShutDownCOM + 0xe3cb

mscorsvr!CoEEShutDownCOM + 0xe37f

mscorsvr!CoEEShutDownCOM + 0xe322

mscorsvr!GetMetaDataPublicInterfaceFromInternal + 0x26ef

mscorsvr!CoEEShutDownCOM + 0x15eae

mscorsvr!ReleaseFusionInterfaces + 0x1d2fa

comsvcs!RegisterComEvents + 0x3f074

comsvcs!RegisterComEvents + 0x40146

ole32!ReadStringStream + 0x22057

ole32!CreateDataAdviseHolder + 0x1534

ole32!CoQueryAuthenticationServices + 0xf5f

ole32!CoQueryAuthenticationServices + 0x1b06

ole32!CoQueryAuthenticationServices + 0x2236

Event Type: Error

Event Source: Application Error

Event Category: (100)

Event ID: 1000

Description: Faulting application w3wp.exe, version 6.0.3790.1830, faulting module kernel32.dll, version 5.2.3790.2756, fault address 0x00015e02. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Data: 0000: 41 70 70 6c 69 63 61 74 Applicat 0008: 69 6f 6e 20 46 61 69 6c ion Fail 0010: 75 72 65 20 20 77 33 77 ure w3w 0018: 70 2e 65 78 65 20 36 2e p.exe 6. 0020: 30 2e 33 37 39 30 2e 31 0.3790.1 0028: 38 33 30 20 69 6e 20 6b 830 in k 0030: 65 72 6e 65 6c 33 32 2e ernel32. 0038: 64 6c 6c 20 35 2e 32 2e dll 5.2. 0040: 33 37 39 30 2e 32 37 35 3790.275 0048: 36 20 61 74 20 6f 66 66 6 at off 0050: 73 65 74 20 30 30 30 31 set 0001 0058: 35 65 30 32 5e02



CAUSE
This problem occurs when the time-out threshold for an ASP.NET request is exceeded. The ASP.NET runtime stops the request by throwing a ThreadAbortException exception for the thread that processes the request. If the ASP.NET request invokes an in-process COM+ component, and if any one of the IObjectControl methods of the component are running at the time of the ThreadAbortException exception, the COM+ runtime will catch the exception and report the fault to Windows Error Reporting. Then, Windows Error Reporting may create event log entries and communicate with error reporting servers. When this behavior occurs, the thread that runs the ASP.NET request will block, and the response is delayed. Windows Error Reporting may also create a dump file of the process. When this behavior occurs, the process is frozen, and all responses are delayed. Processes that host in-process (Library) COM+ applications are not terminated when these faults occur. Additionally, the cycle may repeat during subsequent time-outs and cause additional delays.

Note The sample in the &quot;More Information&quot; section uses a Microsoft .NET Framework ServicedComponent class. However, the same problem can occur if the application uses unmanaged COM+ components.



RESOLUTION
To resolve this problem, avoid the ASP.NET time-out. If the ASP.NET requests are not expected to exceed the time-out threshold, investigate and resolve the source of the underlying delays. The following methods can be effective tools to discover the source of the underlying delay:
 * Analyze dump files of the process that were taken when you experience the underlying delay.
 * Run the application under a profiler utility.
 * Use logging throughout the application.

In some scenarios, the requests should be expected to take longer than the default ASP.NET request time-out. In these scenarios, you should change the time-out value to a more appropriate value. To do this, use one of the following methods:
 * Use the executionTimeout setting.
 * Use the Server.ScriptTimeout property.



WORKAROUND
To work around this problem, you can change the COM+ application from an in-process (library) application to an out-of-process (server) application. In a server application, the COM+ components run in a separate process from the ASP.NET requests. Therefore, the COM+ runtime does not detect a ThreadAbortException exception, and the exception is not reported to the Windows Error Reporting subsystem.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Steps to reproduce the problem
 Follow the steps in Microsoft Knowledge Base article 306296 to create a simple ServicedComponent class and then install the class into COM+. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

306296 How to create a serviced .NET component in Visual C# .NET

  Add the following code example to the ServicedComponent class. protected override void Activate {   // Sleep for 100 seconds. // (The default ASP.NET time-out is 90 seconds.) System.Threading.Thread.Sleep(1000*100); }  Create a Web application in Microsoft Visual C#. To do this, follow these steps:  Start Microsoft Visual Studio .NET. On the File menu, point to New, and then click Project.</li> In the New Project dialog box, click Visual C# Projects under Project Types, and then click ASP.NET Web Application under Templates.</li> In the Location box, type http://localhost/TestWeb1 .</li> Click OK to create the project. WebForm1.aspx is added to your project.</li></ol> </li> In Solution Explorer, right-click TestWeb1, and then click Add Reference.</li> In the Add Reference dialog box, click Browse.</li> In the Select Component dialog box, select the DLL that contains the ServicedComponent-derived class that you generated in step 1.</li> In Solution Explorer, right-click WebForm1.aspx, and then click View Code.</li>  Add the following code example to the Page_Load event procedure. // Create an instance of the ServicedComponent-derived class. // Note: Change the namespace and the class name as appropriate. MyNamespace.MyServicedComponent sc = new MyNamespace.MyServicedComponent;

// Call any method on this object to cause the Activate method to occur. sc.DoTrans; </li> Use a stress test utility to test the http://localhost/TestWeb1/WebForm1.aspx page. For example, follow the steps that are listed in the following Microsoft Knowledge Base article:

815161 How to measure ASP.NET responsiveness with the Web Application Stress Tool

</li></ol>

Keywords: kbtshoot kbbug kbprb KB917069

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.