I have use POSIX; so i tought that :sys_wait_h is included there... I'll add this and check it right now.

Update: I've added this line with :sys_wait_h and seems that nothing has changed.

Here is process tree with the old (REAPER) version that has "unreferenced scalar" problem. Sometimes while many clients are connected there are more processes (I saw up to 8).

30996 pts/0 S 0:00 \_ perl -w ./us2.pl 32396 pts/0 S 0:00 \_ perl -w ./us2.pl 32451 pts/0 R 0:00 | \_ perl -w ./us2.pl 32443 pts/0 S 0:00 \_ perl -w ./us2.pl 32450 pts/0 R 0:00 \_ perl -w ./us2.pl

And here's the new version with :sys_wait_h It has 3 processes at most... and during heavy load it seems to work slower (bu this could be just illusion)

831 pts/0 R 0:28 \_ perl -w ./us2.pl 1745 pts/0 S 0:00 \_ perl -w ./us2.pl 1776 pts/0 R 0:00 \_ perl -w ./us2.pl
What else I can do to "help You to help me" ?

UPDATE2:

I think I've found it!

The solution is compressing both methods in something like this:

use POSIX ":sys_wait_h"; sub REAPER { my $child; while (($child = waitpid(-1,WNOHANG)) > 0) { $Kid_Status{$child} = $?; } $SIG{CHLD} = \&REAPER; # still loathe sysV } $SIG{CHLD} = \&REAPER; # do something that forks...
(taken from perldoc.com)

After some heavy testing (load average on my test computer grew to "48.30" :) I haven't seen any "unreferenced scalar" nor other errors.

Does it look good for You? Or is there something ugly hidden in this method?

(from some time i don't even trust my own linux box ;)

-- Daniellek

In reply to Re: Re: Attempt to free unreferenced scalar... by Daniellek
in thread Attempt to free unreferenced scalar... by Daniellek

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.