views:

58

answers:

1

Processes launched via Process.Start seems to have around a 26-second delay when the spawned process (the "child") launches more new processes (the "grandchildren") - I'm trying to find a way to solve this issue. Specifically, this is occurring when the original process (the "parent") is an ASP.Net website or a Windows Service (tried both).

We're attempting to run a server-side command-line tool to gather information, make modifications in the file system, and continue with other processes when the "child" is finished. When creating the "child" directly via command-line, there is no delay, and with certain command-line parameters, the "child" does not spawn new processes, and there is no delay. However, with other parameters, the "child" spawns "grandchildren" (the same executable as itself, but we can't modify its code) and seems to have a 25-30 second (usually 26 seconds) delay before the first process is started, and then runs normally.

I've tried modifying the UseShellExecute property, the CreateNoWindow property, and the WindowStyle property, to no effect. ErrorDialog and the RedirectStandard* properties are false.

The code I'm using is as follows:

using (Process p = new Process())
{
    p.StartInfo = new ProcessStartInfo(exePath, args)
    {
        WorkingDirectory = workingDirectory,
        UseShellExecute = true,
        CreateNoWindow = true,
    };
    p.Start();
    p.WaitForExit();
}

Oh, I don't think it matters as I've seen the issue referenced elsewhere (but no solutions), but the exePath I'm using points to msysgit's git.exe.

A: 

Hard to tell a reason why this might happen, you need to do further troubleshooting.

I would suggest that you use Process Explorer and Process Monitor to look for potential problems.

I would guess that the problem is not directly in your code but more related to the environment of the user. For example, the w3wp.exe process runs in a non-GUI session (session 0) and the user might not be configured to have web access (proxy configuration) so that you might see a timeout issue here.

0xA3
The strange thing is that it actually does resolve after a short period of time. Process Monitor is a good suggestion - I'll see what's going on and post back with more info.
mattdekrey