PRB: CGI Applications and IIS OOP Applications May Intermittently Fail

ID: Q217202


The information in this article applies to:


SYMPTOMS

When Internet Information Server starts many CGI applications under different users, some of them may fail to initialize properly and terminate prematurely. IIS may generate the following error:

CGI Application misbehaved by not returning a complete set of headers
And this message box may appear:
<ServiceName> - DLL initialization failure Initialization of the dynamic link library
c:\windows\system32\user32.dll failed. The process is terminating abnormally.

Following are some other reasons this problem might occur in your IIS applications:


CAUSE

The W3SVC service (Inetinfo.exe) runs under the Local System account and uses the default system desktop. However, when a CGI request is received, IIS uses the CreateProcessAsUser API to create a new process in the security context of the user whose credentials were submitted with the HTTP request. For each new user, a new desktop object is created. When there are many CGIs created under the security context of different users, the system can run out of memory from an internal heap used for managing desktops.

If many different applications are configured to run OOP in the security context of different users (that is, the MTS package identity for the OOP application has been changed from the IWAM_machinename account), IIS creates a surrogate process (Mtx.exe) that runs in the security context of the configured user. For each user configured as the identity for the OOP package, a new desktop object is allocated.

Running out of the desktop heap may also be a combination of running many OOP applications and many CGI applications in different security contexts.

Another way that the desktop heap may be diminished is by creating a new process with the CreateProcessAsUser function from an ISAPI extension or an ASP COM object (unless there is a desktop for the user that already exists).


RESOLUTION

Knowledge Base article Q142676 "Overcoming User32.dll Initialization Failure Errors" explains a workaround by modifying the SharedSection key in the registry.

Please note that if there is no third parameter specified, the desktop allocates the setting for interactive desktop, which is 3072 (3 MB). By default you should see that the third parameter is 512. Setting this number to a higher value increases the heap for each desktop, but decreases the number of desktops that the system can create.

Setting this number to a lower value (128 is min) has the opposite effect.


STATUS

This behavior is by design.


REFERENCES

Q142676 Overcoming User32.dll Initialization Failure Errors

Q156484 Process Launched with CreateProcess() May Terminate Prematurely

Win32 Platform SDK, "Windows Stations and Desktops" section.



© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Leon Braginski, Microsoft Corporation

Additional query words: kernel32.dll, user32.dll, heap, CGI, ISAPI, MTX.EXE


Keywords          : 
Version           : winnt:3.0,4.0
Platform          : winnt 
Issue type        : kbprb 

Last Reviewed: March 12, 1999