FIX: Fatal execution engine error occurs when AppDomain unloads (321564)



The information in this article applies to:

  • Microsoft .NET Framework 1.0
  • Microsoft .NET Framework 1.0 SP1
  • Microsoft .NET Framework 1.0 SP2
  • Microsoft .NET Framework 1.0 SP3

This article was previously published under Q321564

SYMPTOMS

When your AppDomain unloads, you may receive the following error message in the browser while you request a Web service:
Server Application Unavailable

The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.

Administrator Note: An error message detailing the cause of this specific request failure can be found in the system event log of the web server. Please review this log entry to discover what caused this error to occur.
At the same time, all the following events appear in the application event log:
Event Type: Error
Event Source: ASP.NET 1.0.3705.0
Event Category: None
Event ID: 1000
Date: 5/16/2002
Time: 11:01:11 AM
User: N/A
Computer: COMPUTERNAME
Description:
aspnet_wp.exe (PID: 3644) stopped unexpectedly. For more information, see Help and Support Center at http://support.microsoft.com.

Event Type: Error
Event Source: .NET Runtime
Event Category: None
Event ID: 0
Date: 5/16/2002
Time: 11:01:10 AM
User: N/A
Computer: COMPUTERNAME
Description:
The description for Event ID ( 0 ) in Source ( .NET Runtime ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: .NET Runtime version 1.0.3705.0- aspnet_wp.exe - Common Language Runtime Debugging Services: Application has generated an exception that could not be handled. Process id=0xe3c (3644), Thread id=0x5f4 (1524). Click OK to terminate the application. Click CANCEL to debug the application.

Event Type: Error
Event Source: .NET Runtime
Event Category: None
Event ID: 0
Date: 5/16/2002
Time: 11:01:10 AM
User: N/A
Computer: COMPUTERNAME
Description:
The description for Event ID ( 0 ) in Source ( .NET Runtime ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: .NET Runtime version 1.0.3705.0- : Fatal Execution Engine Error (0x792c7031).
This problem is typically seen in Web service applications.

CAUSE

This error occurs if the .NET runtime cannot dispose of all of the threads when the runtime tries to unload the application. This can occur if the .NET application starts threads and then suspends them so that the threads are in a suspended state or in a sleeping state when an application is unloaded. Because the application (not the .NET runtime) starts these threads, the runtime cannot dispose of these threads.

RESOLUTION

Note Before you apply the hotfix in this section, you must determine the cause of the problem and fix that problem separately in the user code. If you do not fix the problem in your application, an additional AppDomain is spawned each time the AppDomain tries to unload after you apply the fix. This may lead to increased memory consumption.

If you have user-created threads, handle the AppDomain.DomainUnload event, and then dispose of any threads that you have started from your application.

The following Microsoft Visual C# .NET sample demonstrates how to handle the AppDomain.DomainUnload event in your Global.asax file:
		protected void Application_Start(Object sender, EventArgs e)
		{
			AppDomain a = AppDomain.CurrentDomain;
			a.DomainUnload += new EventHandler(DomainUnloadHandler);
		}

		protected void DomainUnloadHandler(Object sender, EventArgs e)
		{
			//This is the event handler for DomainUnload.
		}
				
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft .NET Framework service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
   Date        Time    Version           Size       File name     
   --------------------------------------------------------------
   14-May-2002 18:34  1.0.3705.276       1,953,792  Mscorlib.dll
   14-May-2002 02:33  1.0.3705.276       2,260,992  Mscorsvr.dll
   14-May-2002 02:33  1.0.3705.276       2,260,992  Mscorwks.dll
				

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Modification Type:MajorLast Reviewed:9/22/2006
Keywords:kbHotfixServer kbbug kbfix kbNetFrame100preSP3fix kbQFE KB321564