Advantage Developer Zone

 
 
 

Advantage Knowledgebase Item




Ref No:
101230-2385
Last Modified:
Monday, July 09, 2012
Product:
Advantage Delphi ( General )
Category:
Abend
Title:
Delphi Application Gets External Exception C0000006
Problem Description:
At random moments in Windows 7 or Windows Server 2008 R2, Delphi applications will abnormally end with External Exception C0000006.

This happens when a share is mapped to a drive or the application is started via a UNC path, and is more likely to occur when the share is local in a hosted environment [e.g. Terminal Services].

This issue has been reported to Microsoft a number of times by Delphi developers and end-users.

The issue happens when:
1. An application using ADS is not entirely loaded into memory, and the OS attempts to fetch more of the application into memory so it can continue running.
2. The OS fails to load the requested portion of the program into memory, and suffers from a page fault.
3. After the page fault, the OS terminates the application with an External Exception because it can't continue executing the application.

Note: External exception C0000006 is a page IO error. In this case it happens to occur when Windows tries to load part of a program into memory.
Solution:
Best Solution:
Run the application locally, instead of running from a shared folder on the same server. This prevents the issue from occurring, which indicates this is an operating system issue.

By running the application locally on each workstation, this will require a distributed or client/server model for application updates as opposed to a centralized model (that was possible before with a shared folder location/UNC path). There's a sample Delphi Code Central project available to help template the basic functions of an "updater" application:

Application Update Helper

Possible Solution:
1. Add compiler directive to application project:
{$SetPEFlags IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP}
This directive will force the program to be entirely loaded into memory, and may prevent the external exception from occurring randomly.

Microsoft has published a hot-fix (referenced at http://support.microsoft.com/kb/818528) to address an instance of the issue reported at http://support.microsoft.com/kb/294816.

Note: Avoid local server connections. The cause for external exception C0000006 could result in corruption if using local server connections to a shared path.
Was This Item Helpful?