Ack! Zombie processes won't die!

Keith Dart kdart at kdart.com
Wed Dec 22 11:53:52 EST 2004


Brian wrote:
> From one script, I'm spawnv'ing another that will launch mpg123 to play a 
> specified mp3.  Problem is that After the second script has launched 
> mpg123, it'll turn into a zombie process.  It doesn't happen when I launch 
> it from the command line, so there's something wrong with the way I'm 
> calling it (I believe).
> 
> mp3pid = os.spawnv(os.P_NOWAIT, "/oter/playfile.py", ["playfile", filename, 
> "0"])
> 
> Shouldn't this launch the script without waiting for it to finish?

It does, but the OS keeps the process information around until you 
"wait" on it, with "reaps", or collects the exit status then. You can do 
this asyncronously with a SIGCHLD handler. However, this has already 
been done.

In the the pyNMS package on sourceforge 
(http://sourceforge.net/projects/pynms) there is a module called 
"proctools". It has a process manager that does this for you.


-- 
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Keith Dart <kdart at kdart.com>
    public key: ID: F3D288E4
    =====================================================================



More information about the Python-list mailing list