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?


In reply to Re: Re: Taming multiple external processes by 87C751
in thread Taming multiple external processes by 87C751

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.