From: Daniel DeLorme Date: 2007-07-06T08:10:53+09:00 Subject: Re: zombie invasion - six ways to invoke shell processes Giles Bowkett wrote: > I've got code somebody else wrote. The code uses exec() to invoke > shell processes. It spawns zombies by the thousands. > > I need to redo this over the long term to stop using shell processes at > all. why? it's one of ruby's strengths that it can act as glue between external components rather than having to code everything yourself. > I need it to stop spawning zombies immediately. Look for the cause. Zombie processes are child processes whose return response has not yet been collected by the parent. Since you say that the code uses exec() extensively (when normally it can only be used once and then the program exits), it leads me to think you have something like this: Process.fork{ exec(cmd) } which of course would spawn a lot of zombies. You need to detach the child process from the parent: pid = Process.fork{ exec(cmd) } Process.detach(pid) Daniel