We have created a service that acts as some kind of "process launcher" or monitor.
All it does is monitor certain things and eventually create multiple child processes that do some work. Those child proccesses are simple console-programs, no gui or userinteraction. All runs on a dedicated service user and we can see that everything has session id 0 according to TaskManager.
We noticed, that when the service gets restarted, all the child processes that are still active suddenly throw all various kinds of exceptions.
One suddenly cannot access the ActiveDirectory anymore, another one has issues with UNC paths. Its nothing specific. From my colleagues research we suspect this has something to do with PROCESS_GROUPS. Our first attempt in solving this was to make sure, the child processes are run with CREATE_NEW_PROCESS_GROUP but that didn't help.
Does anyone know what is causing this or how to solve this issue?
One of the exceptions look like this:
System.Runtime.InteropServices.COMException:
Eine Instanz der COM-Komponente mit der CLSID {080D0D78-F421-11D0-A36E-00C04FB950DC} konnte aufgrund
des folgenden Fehlers nicht von der IClassFactory erstellt werden:
800401e4 Ungültige Syntax (Ausnahme von HRESULT: 0x800401E4 (MK_E_SYNTAX)).
We tried using both
uint dwCreationFlags = 0;
...
dwCreationFlags |= CREATE_NEW_PROCESS_GROUP;
dwCreationFlags |= CREATE_NO_WINDOW;
inheritHandles = true // false; both didn't help.
[DllImport("kernel32.dll", CharSet = CharSet.Ansi)]
private static extern bool CreateProcess(
string lpApplicationName,
string lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
string lpEnvironment,
string lpCurrentDirectory,
ref Startupinfo lpStartupInfo,
out ProcessInformation lpProcessInformation);
and
ProcessStartInfo info =...
info.CreateNoWindow = true;
Process.Start(info);
with all various kinds of possible parameters and flags.
User contributions licensed under CC BY-SA 3.0