Windows command jobs fail intermittently with exit code 3322 and status code C0000142.․
The issue may occur on shared servers where jobs begin failing after a period of successful operation.
The Windows System event logs show "desktop heap allocation failed" warnings corresponding to the job failure timestamps.
ERROR MESSAGE: "State FAILED Cmpc(3322) SetEnd" "Status(Aborted, code C0000142)" "desktop heap allocation failed"
SYMPTOMS:
Jobs fail intermittently with exit code 3322
Status code C0000142 appears in agent logs
"Desktop heap allocation failed" warning appears in Windows System logs
Failures increase in frequency until the server reboot
CONTEXT: Occurs on Windows agents executing command jobs.
IMPACT: Scheduled jobs fail to execute, requiring manual intervention or server reboots.
AutoSys Workload Automation Component: SYSAGD
Operating System: Windows
Product Release: 12.1 0000
Workload Automation Agent for Windows 12.1
Environment:
Operating System: Windows
Agent: Workload Automation Agent for Windows 12.1
ROOT CAUSE:
The Windows desktop heap allocation is exhausted, preventing new processes (jobs) from spawning.
This is indicated by the "desktop heap allocation failed" warning in the system logs and the C0000142 (STATUS_DLL_INIT_FAILED) error code,
which often points to initialization failures due to resource exhaustion.
PREREQUISITES:
Administrator access to the Windows server
Permission to edit the Windows Registry
STEPS:
VERIFY DESKTOP HEAP SETTINGS
Navigate to the following registry path to inspect the current heap allocation.
Path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows
EXPECTED: Locate the "DesktopHeap" key or value.
INCREASE DESKTOP HEAP SIZE
Modify the desktop heap allocation value to increase available memory for non-interactive desktops.
Value: Increase from 768 to 4096
WARNING: Backup the registry before making changes. Incorrect registry edits can affect system stability.
NOTE: Ensure the value is appropriate for the system architecture.
REBOOT SERVER
Restart the Windows server to apply the registry changes.
EXPECTED: The new desktop heap allocation takes effect.
VERIFY SUCCESS:
Jobs execute successfully without exit code 3322
No new "desktop heap allocation failed" warnings appear in System logs