4.30.1-1 Feedback

Rick Cooper rcooper at DWFORD.COM
Fri Apr 23 16:26:45 IST 2004


> -----Original Message-----
> From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK]On
> Behalf Of Julian Field
> Sent: Friday, April 23, 2004 9:28 AM
> To: MAILSCANNER at JISCMAIL.AC.UK
> Subject: Re: 4.30.1-1 Feedback
>
>
> I will shortly be producing a 4.30.2 to see if I can address
> these problems
> satisfactorily.

I was kind of looking at the two issues I had. I found that the decreasing
children was because when a child died of old age no child was restarted
until the last child died, and then only one was started. So I made the
following changes :

*** MailScanner.def     Fri Apr 23 10:04:21 2004
--- MailScanner Fri Apr 23 10:01:26 2004
***************
*** 609,618 ****
  #
  # Function to harvest dead children
  #
  sub Reaper {
!   1 until waitpid(-1, WNOHANG) == -1;
!   $SIG{'CHLD'} = \&Reaper;  # loathe sysV
  }

  #
  # Fork off and become a daemon so they get their shell back
--- 609,623 ----
  #
  # Function to harvest dead children
  #
  sub Reaper {
! #  1 until waitpid(-1, WNOHANG) == -1;
! #  $SIG{'CHLD'} = \&Reaper;  # loathe sysV
!    my $stiff;
!     while (($stiff = waitpid(-1, &WNOHANG)) > 0) {
!         # do something with $stiff if you want
!     }
!     $SIG{CHLD} = \&REAPER;                  # install *after* calling
waitpid
  }

  #
  # Fork off and become a daemon so they get their shell back
***************
*** 643,655 ****
        # This new grand-child's parent is init
        #print STDERR "In the grand-child\n";
        #$SIG{'CHLD'} = 'DEFAULT';
        # Auto-reap children
!       $SIG{'CHLD'} = 'IGNORE';
        setsid();
      } else {
        #print STDERR "In the parent\n";
!       wait; # Ensure child has exited
        exit 0;
      }
      # This was the old simple code in the 2nd half of the if statement
      #fork && exit;
--- 648,661 ----
        # This new grand-child's parent is init
        #print STDERR "In the grand-child\n";
        #$SIG{'CHLD'} = 'DEFAULT';
        # Auto-reap children
! #      $SIG{'CHLD'} = 'IGNORE';
!         $SIG{'CHLD'} = \&Reaper;
        setsid();
      } else {
        #print STDERR "In the parent\n";
! #      wait; # Ensure child has exited
        exit 0;
      }
      # This was the old simple code in the 2nd half of the if statement
      #fork && exit;


That handled the respawn problem (I think the wait() was it)but I was back
to having Zombies so I did this:



*** MailScanner.def     Fri Apr 23 10:04:21 2004
--- MailScanner Fri Apr 23 10:10:41 2004
***************
*** 609,618 ****
  #
  # Function to harvest dead children
  #
  sub Reaper {
!   1 until waitpid(-1, WNOHANG) == -1;
!   $SIG{'CHLD'} = \&Reaper;  # loathe sysV
  }

  #
  # Fork off and become a daemon so they get their shell back
--- 609,623 ----
  #
  # Function to harvest dead children
  #
  sub Reaper {
! #  1 until waitpid(-1, WNOHANG) == -1;
! #  $SIG{'CHLD'} = \&Reaper;  # loathe sysV
!    my $stiff;
!     while (($stiff = waitpid(-1, &WNOHANG)) > 0) {
!         # do something with $stiff if you want
!     }
!     $SIG{CHLD} = \&REAPER;                  # install *after* calling
waitpid
  }

  #
  # Fork off and become a daemon so they get their shell back
***************
*** 624,632 ****
      # Get current debugging flag, and invert it:
      my $current = config MIME::ToolUtils 'DEBUGGING';
      #config MIME::ToolUtils DEBUGGING => !$current;
    } else {
!     $SIG{'CHLD'} = \&Reaper;
      if (fork==0) {
        # This child's parent is perl
        #print STDERR "In the child\n";
        # Close i/o streams to break connection with tty
--- 629,638 ----
      # Get current debugging flag, and invert it:
      my $current = config MIME::ToolUtils 'DEBUGGING';
      #config MIME::ToolUtils DEBUGGING => !$current;
    } else {
!     #$SIG{'CHLD'} = \&Reaper;
!       $SIG{'CHLD'} = 'IGNORE';
      if (fork==0) {
        # This child's parent is perl
        #print STDERR "In the child\n";
        # Close i/o streams to break connection with tty
***************
*** 644,655 ****
        #print STDERR "In the grand-child\n";
        #$SIG{'CHLD'} = 'DEFAULT';
        # Auto-reap children
        $SIG{'CHLD'} = 'IGNORE';
        setsid();
      } else {
        #print STDERR "In the parent\n";
!       wait; # Ensure child has exited
        exit 0;
      }
      # This was the old simple code in the 2nd half of the if statement
      #fork && exit;
--- 650,662 ----
        #print STDERR "In the grand-child\n";
        #$SIG{'CHLD'} = 'DEFAULT';
        # Auto-reap children
        $SIG{'CHLD'} = 'IGNORE';
+ #       $SIG{'CHLD'} = \&Reaper;
        setsid();
      } else {
        #print STDERR "In the parent\n";
! #      wait; # Ensure child has exited
        exit 0;
      }
      # This was the old simple code in the 2nd half of the if statement
      #fork && exit;

And the Zombies are gone, I am not getting any syslog errors (at least not
yet) and when a child dies of old age it is immediately restarted. BTW: to
test the respawn problem I set
Restart Every = 10 so th handling child would die every time it handled a
message and they are happily respawning without zombies for a while now.
Sorry I posted the patches inline but I wanted Julian to be able to follow
the thought process and see if I missed something or did something he didn't
agree with.

Have a look Julian and see what you think

Rick

>
> I need to write some timeout code to wrap all the CustomFunctions too,
> though I might just provide a timeout wrapper framework for other
> people to
> use if they need it, as it adds quite a large overhead to any Custom
> Functions that don't need it.
>
> Any thoughts?
>
> At 14:12 23/04/2004, you wrote:
> > > -----Original Message-----
> > > From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK]On
> > > Behalf Of Gerry Doris
> > > Sent: Friday, April 23, 2004 8:00 AM
> > > To: MAILSCANNER at JISCMAIL.AC.UK
> > > Subject: 4.30.1-1 Feedback
> > >
> > >
> > > As I mentioned in an earlier email, I installed 4.30.1-1 and
> immediately
> > > had kernel error messages appear.  These were fixed by
> changing the IGNORE
> > > equate in /usr/sbin/MailScanner to \&Reaper.
> > >
> > > However, I now get the following error message every time a
> MailScanner
> > > child dies:
> > >
> > >
> > > Apr 23 05:50:36 tiger root: Process did not exit cleanly,
> > > returned 16777215
> > > with signal 255
> > >
> >
> >I did same, I get same error and when I check for running MS process I
> >always have only one child except if I restart, then I load
> normal children
> >but as they die only one is respawned
> >
> >Rick
> >
> >-------------------------- MailScanner list ----------------------
> >To leave, send    leave mailscanner    to jiscmail at jiscmail.ac.uk
> >For further info about MailScanner, please see the Most Asked
> >Questions at    http://www.mailscanner.biz/maq/     and the archives
> >at    http://www.jiscmail.ac.uk/lists/mailscanner.html
>
> --
> Julian Field
> www.MailScanner.info
> Professional Support Services at www.MailScanner.biz
> MailScanner thanks transtec Computers for their support
> PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
>
> -------------------------- MailScanner list ----------------------
> To leave, send    leave mailscanner    to jiscmail at jiscmail.ac.uk
> For further info about MailScanner, please see the Most Asked
> Questions at    http://www.mailscanner.biz/maq/     and the archives
> at    http://www.jiscmail.ac.uk/lists/mailscanner.html
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
>

-------------------------- MailScanner list ----------------------
To leave, send    leave mailscanner    to jiscmail at jiscmail.ac.uk
For further info about MailScanner, please see the Most Asked
Questions at    http://www.mailscanner.biz/maq/     and the archives
at    http://www.jiscmail.ac.uk/lists/mailscanner.html



More information about the MailScanner mailing list