in reply to Re: Attempt to free unreferenced scalar...
in thread Attempt to free unreferenced scalar...
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)
What else I can do to "help You to help me" ?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
UPDATE2:
I think I've found it!
The solution is compressing both methods in something like this:
(taken from perldoc.com)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...
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
|
|---|