After having a look at the code and testing further, I think that the problem is the local scope of the $SIG{CHILD} in ForkManager's sub wait_on. Obviously, the empty subroutine is set in order to yank the process free of the following sleep (select) statement, otherwise IGNORE/undef would do just fine. When the process leaves the sub on_wait, then $SIG{CHILD} is reset to undef (likely meaning IGNORE). However, if more signals hit the process at just the right time (when exiting the sub/resetting $SIG{CHILD}), then the error is triggered. I can reproduce it outside ForkManager, so it is nothing special in ForkManager.

This error should only occur in forkmanager if the user has not set $SIG{CHILD}.

I see two possible solutions. Either remove the "local" clause on $SIG{CHLD} in ForkManager sub wait_on, OR simply set the following before you call ForkManager:

$SIG{CHLD} = sub { };

Best regards, /Bjarne

In reply to Re: Parallel ForkManager error with run_on_wait() by Anonymous Monk
in thread Parallel ForkManager error with run_on_wait() by sojourn548

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.