Windows output redirection and zombie processes

26Aug05

Just a quick note — I’ve been working on a parallelized Windows build system, which farms the build out to one of several build servers.

The actual compilation of code is done by MSVC6 right now (there’s been talk of moving to VS .NET 2003, but with 2005 coming out, there’s been less impetus to make the move now), and my system launches the build by executing a command like this:

msdev.exe /MAKE MyProject.dsw "Target1" "Target2"

This invariably resulted in a cmd.exe session being spawned alongside the vcspawn.exe and msdev.exe sessions. The strange thing was that each process took very little memory, and no CPU time! I also experimented with running msdev.com, in the vague hope that something would turn out differently, but that resulted in a similar zombie process, though this time without an accompanying cmd.exe.

A little experimentation revealed that the problem was where the output from the build was going.

Running the command directly at the command prompt showed that when you run msdev.exe, output is passed to a new cmd.exe instance. On the other hand, when you run msdev.com, the output is piped to the current cmd.exe instance. For some reason, the new cmd.exe instance wasn’t happy (quite possibly logging an error and killing the build), and died — but didn’t take the processes along with it!

Armed with this knowledge, I hoped that running msdev.com would be the solution to my worries. Unfortunately, it turned out my builds still only launched zombie processes which never actually got anywhere.

The eventual solution? Use the /OUT flag to send output to a logfile:

msdev.exe /MAKE MyProject.dsw "Target1" "Target2" /OUT log.txt

0 Responses to “Windows output redirection and zombie processes”


  1. No Comments

Leave a Reply


Comment guidelines: No spamming, no profanity, and no flaming. Inappropriate comments will be deleted outright.