in reply to Re: Taming multiple external processes
in thread Taming multiple external processes

I'm using kill 1, $pid;, and I've tried all of 1, 9, HUP, INT, SIGHUP, SIGINT and SIGKILL, all with the same result. Even setting local $SIG{HUP} = $SIG{INT}; made no change. Each time, app2 dies and the sh process becomes a zombie, but I still have 4 app1 processes. If I then kill the server that spawned them, all of the processes vanish.

Here's a ps list after a client has connected:

7314 pts/1 S 0:00 /usr/bin/perl -w ./testserver 7315 pts/1 S 0:00 sh -c ogg123 -q -d raw -f - http://cal.icec +ast.net:8630/prog1.ogg | lame --silent -b 320 -r - 7316 pts/1 S 0:00 ogg123 -q -d raw -f - http://cal.icecast.ne +t:8630/prog1.ogg 7317 pts/1 S 0:00 lame --silent -b 320 -r -x - - 7318 pts/1 S 0:00 ogg123 -q -d raw -f - http://cal.icecast.ne +t:8630/prog1.ogg 7319 pts/1 S 0:00 ogg123 -q -d raw -f - http://cal.icecast.ne +t:8630/prog1.ogg 7321 pts/1 S 0:00 ogg123 -q -d raw -f - http://cal.icecast.ne +t:8630/prog1.ogg

After the client disconnects, the server does kill 1, $pid on the pid returned from open2. The ps list now looks like this:

7314 pts/1 S 0:00 /usr/bin/perl -w ./testserver 7315 pts/1 Z 0:00 [sh] <defunct> 7316 pts/1 S 0:00 ogg123 -q -d raw -f - http://cal.icecast.ne +t:8630/prog1.ogg 7318 pts/1 S 0:00 ogg123 -q -d raw -f - http://cal.icecast.ne +t:8630/prog1.ogg 7319 pts/1 S 0:00 ogg123 -q -d raw -f - http://cal.icecast.ne +t:8630/prog1.ogg 7321 pts/1 S 0:00 ogg123 -q -d raw -f - http://cal.icecast.ne +t:8630/prog1.ogg

You see that lame (my app2) is gone, and the shell is zombied. But all the ogg123 (app1) processes are still alive (and, according to the activity lights on the switch, still sucking data from the URL).

Am I going mad?