Re: Zombie Trouble Shooting

2006-04-07 Thread Chas Owens
On 4/7/06, John W. Krahn <[EMAIL PROTECTED]> wrote: > Chas Owens wrote: > > On 4/6/06, John W. Krahn <[EMAIL PROTECTED]> wrote: > > snip > >>If you had strictures enabled then perl would have told you. Make sure that > >>this is near the top of your programs: > >> > >>use strict; > > snip > > > >

Re: Zombie Trouble Shooting

2006-04-07 Thread John W. Krahn
Chas Owens wrote: > On 4/6/06, John W. Krahn <[EMAIL PROTECTED]> wrote: > snip >>If you had strictures enabled then perl would have told you. Make sure that >>this is near the top of your programs: >> >>use strict; > snip > > Yes, always good advice. Unfortunately it would not have helped me > h

Re: Zombie Trouble Shooting

2006-04-06 Thread Chas Owens
On 4/6/06, John W. Krahn <[EMAIL PROTECTED]> wrote: snip > If you had strictures enabled then perl would have told you. Make sure that > this is near the top of your programs: > > use strict; snip Yes, always good advice. Unfortunately it would not have helped me here since I was using the Perl

Re: Zombie Trouble Shooting

2006-04-06 Thread John W. Krahn
Chas Owens wrote: > On 4/6/06, John W. Krahn <[EMAIL PROTECTED]> wrote: > snip >>No, the lexical $handler holds the anonymous subroutine. > snip > > Ah, you are right, the code should be If you had strictures enabled then perl would have told you. Make sure that this is near the top of your prog

Re: Zombie Trouble Shooting

2006-04-06 Thread Chas Owens
On 4/6/06, John W. Krahn <[EMAIL PROTECTED]> wrote: snip > No, the lexical $handler holds the anonymous subroutine. snip Ah, you are right, the code should be { #setup the auto-reaper for fork'ed children my $handler; $handler = sub { my $pid; while (($pid = waitpid(-1, &W

Re: Zombie Trouble Shooting

2006-04-06 Thread John W. Krahn
Chas Owens wrote: > On 4/6/06, John W. Krahn <[EMAIL PROTECTED]> wrote: > snip >>>use POSIX ":sys_wait_h"; >>> >>>my $handler = sub { >>>my $pid; >>>while (($pid = waitpid(-1, &WNOHANG)) > 0) { >>># do something with $pid >>>} >>>$SIG{CHLD} = $handler #reinstall the handler

Re: Zombie Trouble Shooting

2006-04-06 Thread Chas Owens
On 4/6/06, John W. Krahn <[EMAIL PROTECTED]> wrote: snip > > use POSIX ":sys_wait_h"; > > > > my $handler = sub { > > my $pid; > > while (($pid = waitpid(-1, &WNOHANG)) > 0) { > > # do something with $pid > > } > > $SIG{CHLD} = $handler #reinstall the handler > > When perl c

Re: Zombie Trouble Shooting

2006-04-06 Thread John W. Krahn
Chas Owens wrote: > > You can also use $SIG{CHLD} to install a handler if you are not as > heartless as I am. This is similar to calling waitpid() in your main > loop, but has the benefit of handling all children as soon as > possible. The only drawback is that make the code harder to read and >

Re: Zombie Trouble Shooting

2006-04-06 Thread Chas Owens
On 4/6/06, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: snip > Zombies happen for two reasons. The first it that it is waiting for its > parent to harvest its status code. snip Just to expand on this, there are several methods of harvesting the status code of your children. The first is simply w

Re: Zombie Trouble Shooting

2006-04-06 Thread Mr. Shawn H. Corey
On Thu, 2006-06-04 at 07:54 -0400, John Ackley wrote: > Can anyone recommend any debugging tools or techniques? If it's important for this program to be running all the time, you should add it to you init(8) rc files. Zombies happen for two reasons. The first it that it is waiting for its parent

Zombie Trouble Shooting

2006-04-06 Thread John Ackley
I have a perl script that becomes a zombie. It runs fine for days or weeks checking for new data every 60 seconds. But after a long period of time running on Red Hat 9, Fedora Core 4, and now Fedora Core 5 it remains in memory as an active process and maintains its network tcp/ip connections but