Chris Wagner wrote:

> I've never heard of munin but I see one problem right here.  This while loop
> will never exit.  The <> operator only fires when a new line sequence is
> encountered.  However ur equality test doesn't have a \n in it and there's
> no chomp() on $_. Try this:
> 
> while(<CHILD>) {
>     chomp $_;
>     #last if $_ eq "# DONE";
>     if ($_ eq "# DONE") { close(CHILD); }
>     push @lines, $_;
>     print "#DEBUG CHILD: $_" if $DEBUG;
> }
> 
> This way when the child script prints a "# DONE\n" the loop will recognize it.

Hi Chris,

Thanks for the feedback.  In the email, I've just pasted the context 
from the other lists.  The original munin didn't have a line checking 
for # DONE to end the loop.  This was a dirty hack by me to see if I 
could bypass the FH not closing.

I'll add the chomp() and the code that reinserts a \n and see if that 
helps.  What this line led me to was the conclusion that in many cases, 
the reason it doesn't return in because the child doesn't send anything.

When I was running the child, there was nothing being printed with 
#DEBUG CHILD - only occasionally.

WHen I did the strace, I saw that when this happened, the fork() took 
forever (the worst I've seen was 60 seconds!).

What interesting is I never have the timeouts if the program being 
exec'd is a shell script - only ever with perl.

I found something on the Google that suggested that ReadProcessMemory 
and WriteProcessMemory are being delayed by something.   Somebody else 
had fixed this by removing an obscure firewall.  I dont have this 
installed though and on one machine this is fine, yet on another with 
the exact same install it's broken.

In any case, I'm going to make the changes as you suggested as it's 
likely to reduce my number of timeouts to only those that are there when 
  bad fork() things happen.

Cheers!

George
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to