A BatchPatch user recently reported a new error that we had never encountered before. It comes in two flavors, depending on whether the action was executed with integrated security or alternate logon credentials:
Windows Update: Error 1611: -1073741502. Failure Windows Update: Error 1620: -1073741502. Failure |
You may also see something like this screenshot, likely with a corresponding entry in the Windows application event log, though not necessarily.
Note, to review the event log on the BatchPatch computer click on ‘Start > Run‘ and then type ‘eventvwr‘ without the quotes.
Then in the left-side pane of the Event Viewer window, expand Windows Logs and then select Application to view the application event log.
What does this error mean?
HRESULT -1073741502 C0000142 STATUS_DLL_INIT_FAILED |
When it comes to memory allocation in Windows, there is a system heap for all system processes, a desktop heap for all user processes running under a particular interactive logon session, and then there is also non-interactive desktop heap for processes that run in a non-interactive session. The interactive session is the logon session that you are literally interacting with when you are using your computer– the session where you have applications visible in front of you. Non-interactive sessions are for processes that run outside of the interactive session, like the BatchPatch service instance. It may be possible under certain circumstances to exhaust the available heap memory, particularly in a non-interactive session, which subsequently may cause the aforementioned error to occur.
While this error is exceedingly rare (we have only ever had a single report of it), if you encounter this error it is most likely going to be due to a resource allocation limitation on the BatchPatch server at the time of execution. Specifically it’s likely to be caused by not enough allocated non-interactive heap memory. As a consequence of the resource limitation, at least one DLL required for the application (in this case PsExec) to run fails to initialize. It’s likely that you would only ever encounter this error when running BatchPatch as a service because the default interactive heap size is significantly larger than the default non-interactive heap size. The non-interactive heap, which is used by the BatchPatch service instance, is therefore much more likely to run out of space. To be clear, the issue is not likely to be caused by there not being enough physical RAM in the system. Rather, the issue appears to occur because of how Windows is configured by default to allocate the heap memory.
Resolution steps:
There is a registry value that controls how much memory is allocated to each of the three heaps in Windows. More details here: “Out of Memory” error message appears when you have a large number of programs running
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SubSystems\Windows |
The registry value above contains a parameter for SharedSection that will look something like this: SharedSection=1024,20480,768
The numerical values 1024,20480,768 define the memory, in KB, that Windows allocates for the system, desktop, and non-interactive heaps, respectively: SharedSection=[system],[desktop],[non-interactive]
If you encounter the error mentioned in the title of this posting while running BatchPatch as a service, try increasing the size of the non-interactive heap in Windows. I wouldn’t suggest increasing it to an arbitrarily determined very large number. Instead try increasing it enough to resolve the issue without going way overboard. On my system if this were occurring, as a first test I would probably try changing it from 768KB to 2048KB (SharedSection=1024,20480,768 to SharedSection=1024,20480,2048) and then see how it goes.