i have a server, which forks children to deal with connections, but when i send INT signals to the server the children do not always get them.

my server, which forks and deals with each incoming connection. when i send the server an INT (ie i hit ^C on the console) it is supposed to stop doing everything, but i found the children continue... i altered the parent's responce to a SIGINT to send all the children a SIGINT as well. to do this i set
$SIG{INT} = 'IGNORE';
then send the INT back to the whole process group with
kill -2, $$;
i don't know that this is the most elegant way, but after doing this i find that i send an INT to the server both it and it's children all do down.

this is what i want, except, if the child is in the middle of a command, it completely misses getting the signal. the command fails, and the child keeps on running. and will continue to respond to more commands.

i am guessing this has to do with the child being in a system() call when it gets the INT...

the next trick is, if i change the above code to
local $SIG{INT} = 'IGNORE';
the children get teh signal no matter what, but the parent doesn't ignore it, gets it twice and seg faults...

so i would like input on remedies to this problem, or alternatives means of interrupting the server that do not have this problem...
TIA, xanatax.

In reply to lost signals by Xanatax

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.