I am trying to rasterise a map using wkhtmltoimage. I am spinning up a new process and passing it the command line arguments that are necessary to get the image that I want.
I'm currently suffering from a very long pause when the process is started. I've enabled showing the window to see if there is any dialog related activity that requires user input but there is none. The process sits at 0% CPU for 2 - 3 minutes. Executing the same command on the command like takes a few seconds.
using (Process p = new Process())
{
ProcessStartInfo info = new ProcessStartInfo(wkhtmlPath, dimensions + EscapeArgument(location) + " -");
info.UseShellExecute = false;
info.RedirectStandardOutput = true;
p.StartInfo = info;
p.Start();
byte[] buffer = new byte[32768];
int read = 0;
while ((read = p.StandardOutput.BaseStream.Read(buffer, 0, buffer.Length)) > 0)
{
//... write bytes to the an ouput buffer
}
}
It's taking in the order of minutes to complete. This works fine when it doesn't point at one of my controllers using the same session. When it uses the same session, the print controller waits for a response from wkhtmltoimage, which is waiting for the print controller to release the lock so it can get the page. Some timeout must be breaking this deadlock. Can I safely release the session lock somehow?