Back

Topic

[KB1124]Adjusting registry settings to run PcVue as a service on a Web back end station

Tags: PcVue as a service, Webvue

3 years ago
By LM
Options
Print
Applies to:

PcVue 11.2 onwards


Symptom:

Running PcVue as a Windows service application on a Web back end station causes a crash of the sv32 process under certain conditions. If PcVue is running in an interactive session instead, this problem does not occur.

If you find that you cannot open more than a certain number of mimics in Web/Mobile client systems, even using a very large RAM Web back end station, you may have run into a limit of the Windows “desktop heap size”.

Additionally, the following warning event (ID 243) is logged in the system log at the time of the crash:
Event 243 A desktop heap allocation failed

Cause

PcVue ran into an issue that is caused by “desktop heap” exhaustion.

This occurs due to differences in the way heap allocation occurs when PcVue is running as a service as opposed to running it in an interactive session.

The problem is that service session (where the services run) has less “desktop heap” space available for creating User Interface objects than interactive sessions.

The short version is:

  • User Interface objects (such as menus, icons, and windows) are created on a PcVue Web back end station even if we cannot see them.
  • Desktop heap size limits the number of User Interface objects.
  • The default desktop heap size allocated for services is so much smaller than that for interactive applications.

Desktop heap size is not affected by the physical RAM on the computer and cannot be improved by adding physical RAM. Even on a very large RAM computer, you may have run into a limit of the Windows “desktop heap size”.

Every desktop object on the system has a desktop heap that is associated with it. The desktop object uses the heap to store menus, icons, windows, etc. Desktops are associated with window stations. A window station can contain zero or more desktops.

The following Microsoft Developer “Desktop Heap Overview” Blog provides an informative discussion on the subject: https://blogs.msdn.microsoft.com/ntdebugging/2007/01/04/desktop-heap-overview/


Details:

IMPORTANT: This method contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base: 322756 – How to back up and restore the registry in Windows

The following registry changes applies only to programs that are running as services and affects the desktop heap of all services.

Starting with Windows Vista and Windows Server 2008, the size of each desktop heap allocation is controlled by the following registry value:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SubSystems\Windows

The default data for this registry value will look something like the following (all on one line):

%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,20480,768 Windows=On SubSystemType=Windows …

The portion of interest is “SharedSection=1024,20480,768”.

The numeric values following “SharedSection=” control how desktop heap is allocated. These SharedSection values are specified in kilobytes (KB):

  • The first SharedSection value (1024) is the Session View space which is a dynamic kernel address range since Windows Vista. This registry value is no longer used.
  • The second SharedSection value (20480) specifies the size of the desktop heap for each desktop that is associated with an interactive window station.
  • The third SharedSection value (768) specifies the size of the desktop heap for each desktop that is associated with a non-interactive (service) window station, which is a lot smaller than that available for an interactive window station.

You should increase the third SharedSection value to allow PcVue to run as a service with limits comparable to those that can be obtained in an interactive session.

Experimentally, we found that changing the third SharedSection value from 768 to 4096 should be the right compromise.

The system must be restarted for this change to take effect.

WARNING: Please do not modify this value on a whim. Changing the third SharedSection value too high can put the system in a no-boot situation due to the kernel not being able to allocate memory properly to even get Session 0 set up. Because the Service Control Manager (SCM) creates a new desktop in the non-interactive window station for every service process that is running under a user account, a larger third SharedSection value will reduce the number of user account services that can run successfully on the system. Do not make this value larger than necessary, and no larger than 8192, as each service in the system will consume more of a valuable resource.


Created on: 02 Aug 2021 Last update: 04 Sep 2024