I tried your script and used every combination I found mentioned in perlipc (i.e. without posix) and couldn't get it to work either. It seems definitely broken.

A trace shows this difference between a successful handling and an unsuccessful:

#ok: write(1, "got signal.\n", 12got signal. ) = 12 wait4(-1, 0x7fff97d3635c, WNOHANG, NULL) = -1 ECHILD (No child process +es) rt_sigprocmask(SIG_BLOCK, [USR1], [USR1], 8) = 0 rt_sigaction(SIGUSR1, {0x4ba320, [], SA_RESTORER, 0x7ff73ec382e0}, {0x +4ba320, [], SA_RESTORER, 0x7ff73ec382e0}, 8) = 0 rt_sigprocmask(SIG_SETMASK, [USR1], NULL, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [USR1], NULL, 8) = 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 #not ok: write(1, "got signal.\n", 12got signal. ) = 12 wait4(-1, 0x7fff97d3635c, WNOHANG, NULL) = -1 ECHILD (No child process +es) rt_sigprocmask(SIG_BLOCK, [USR1], [USR1], 8) = 0 rt_sigaction(SIGUSR1, {0x4ba320, [], SA_RESTORER, 0x7ff73ec382e0}, {0x +4ba320, [], SA_RESTORER, 0x7ff73ec382e0}, 8) = 0 rt_sigprocmask(SIG_SETMASK, [USR1], NULL, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [USR1], NULL, 8) = 0 rt_sigaction(SIG_0, NULL, {0x8ab3b8, [], SA_NOCLDSTOP}, 8) = -1 EINVAL + (Invalid argument)

The difference is the call to rt_sigaction instead of a third rt_sigprocmask, seemingly unprovoked by any return values from the operating system. So my guess is the problem is in the perl code. It seems a case for a debugger now


In reply to Re: How to prevent Perl from exit when SIGUSR1 recieved? by jethro
in thread How to prevent Perl from exit when SIGUSR1 recieved? by cmyker

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.