Microsoft KB Archive/217202

From BetaArchive Wiki
Knowledge Base


Article ID: 217202

Article Last Modified on 11/3/2003



APPLIES TO

  • Microsoft Internet Information Server 3.0
  • Microsoft Internet Information Server 4.0
  • Microsoft Internet Information Services 5.0



This article was previously published under Q217202

SYMPTOMS

When Microsoft 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:

  • IIS is configured to run many different Out Of Process (OOP) applications, and the identity of each MTS package was changed in the Microsoft Transaction Server configuration from the default IWAM_machinename to a different user name for each package.
  • An ISAPI extension or COM object launched from an Active Server Pages (ASP) page creates many new processes with the CreateProcessAsUser function under the security contexts of different users. Note that this problem will not occur if the CreateProcess function is used instead of the CreateProcessAsUser function.


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 142676 "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.

Note When IIS 5.0 runs on Microsoft Windows 2000, COM+ is used and MTS is not. Also, the surrogate process name is DLLHost.exe, not Mtx.exe.

REFERENCES

For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

142676 Overcoming User32.dll Initialization Failure Errors



156484 Process Launched with CreateProcess() May Terminate Prematurely



184802 PRB: User32.dll or Kernel32.dll Fails to Initialize


156484

For more information, see the "Windows Stations and Desktops" section of the Win32 Platform SDK.



Additional query words: kernel32.dll user32.dll heap CGI ISAPI

Keywords: kbprb KB217202