Subject: | Correctly reap children processes |
From the amavisd-new user list:
--- Net/Server/PreFork.pm~ 2010-07-08 21:13:47.000000000 +0200
+++ PreFork.pm 2011-01-04 18:48:54.103050023 +0100
@@ -331,4 +331,13 @@
);
+ ### reclaim process exit status from any terminated child process
+ ### inherited from a previous incarnation whose SIGCHLD signal was
+ ### ignored during a blind period between a restart and the moment
+ ### when the SIGCHLD handler was established just now
+ while ( defined(my $chld = waitpid(-1, WNOHANG)) ){
+ last unless $chld > 0;
+ $self->{reaped_children}->{$chld} = 1;
+ }
+
### loop on reading info from the children
while( 1 ){
--- Net/Server/PreForkSimple.pm~ 2010-05-05 05:01:58.000000000 +0200
+++ Net/Server/PreForkSimple.pm 2011-01-04 18:40:23.631629852 +0100
@@ -332,4 +332,13 @@
);
+ ### reclaim process exit status from any terminated child process
+ ### inherited from a previous incarnation whose SIGCHLD signal was
+ ### ignored during a blind period between a restart and the moment
+ ### when the SIGCHLD handler was established just now
+ while ( defined(my $chld = waitpid(-1, WNOHANG)) ){
+ last unless $chld > 0;
+ $self->delete_child($chld);
+ }
+
### loop forever
while( 1 ){