Date: Thu, 8 Aug 2002 14:40:04 -0700 (PDT) From: ian j hart <ianjhart@ntlworld.com> To: freebsd-ports@FreeBSD.org Subject: Re: ports/41455: amavisd-snapshot-20020531 hangs with sendmail milter Message-ID: <200208082140.g78Le44c018236@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/41455; it has been noted by GNATS. From: ian j hart <ianjhart@ntlworld.com> To: freebsd-gnats-submit@FreeBSD.org, ianjhart@ntlworld.com Cc: Subject: Re: ports/41455: amavisd-snapshot-20020531 hangs with sendmail milter Date: Thu, 08 Aug 2002 22:39:41 +0100 Patches as promised. # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # patch-aa # echo x - patch-aa sed 's/^X//' >patch-aa << 'END-of-patch-aa' X--- amavis/amavisd.in.orig 2002-05-13 19:52:15.000000000 +0100 X+++ amavis/amavisd.in 2002-06-09 19:04:25.878040968 +0100 X@@ -123,7 +123,7 @@ X # X # Client/server/daemon related X X-my ($socketname, $parentpid, $tmppid) = ("@sockname@", 0, 0); X+my ($socketname, $parentpid, $diedpid, $tmppid) = ("@sockname@", 0, 0, 0); X X # flag to indicate compressing file format X my $some_compression = 0; X@@ -167,20 +167,22 @@ X # X # Set up signal handling X X-my(%child_status,%child_stime,%child_etime); X- X # X # SIGCHLD handler X sub deadbabe { X- for (;;) { X- my $childpid = wait; X- last if $childpid < 0; X- $child_status{$childpid} = $?; X- $child_etime{$childpid} = time; X- } X+ do { X+ $tmppid = waitpid(-1, &WNOHANG); X+ } while ($tmppid > 0); X+ $diedpid = 1; X $SIG{CHLD} = \&deadbabe; X+# stupid sys5 resets the signal when called - but only -after- the wait... X } X-$SIG{CHLD} = \&deadbabe; X+# Catch any dead child process X+ X+# If IGNORE leaves zombies behind on your system, X+# switch the comments between the two lines below X+# $SIG{CHLD} = \&deadbabe; X+$SIG{CHLD} = 'IGNORE'; X X # may need to do more - eg. if logging changes, close/reopen syslog/log file X # rethink - handler should be simple X@@ -240,15 +242,16 @@ X sub main_loop() { X my ($inbuff, $mpid, $a); X X- for (;;) { X- $a = accept(Client,Server); X+ while (($a = accept(Client,Server)) || $diedpid) { X X do_log(3,"enter accept loop"); X- report_children(); X- X- # if the accept returned purely because of a caught X- # sigchld, then continue X- next unless $a; X+ # now we start the repeating loop... X+ if ($diedpid) { X+ $diedpid = 0; X+ # if the accept returned purely because of a caught sigchld X+ # then continue X+ next unless (defined($a)); X+ } X X if (!defined($mpid = fork)) { X shutdown Server, 2; X@@ -257,12 +260,12 @@ X } X X # if we're the parent, just go back to the accept loop X- if ($mpid) { # we are the parent X- $child_stime{$mpid} = time; X- next; # just go back to the accept loop X- } X- $SIG{CHLD} = undef; X- do_log(3,"forked off -- child [$$] running..."); X+ next if ($mpid); X+ X+ do_log(3,"forked off -- child running..."); X+ X+ $SIG{CHLD} = 'DEFAULT'; X+ # reset sigchild - we don't want to mess up $? for the virus scanner X X # X # Receive TEMPDIR/SENDER/RCPTS/LDA/LDAARGS from client X@@ -1326,9 +1329,6 @@ X do_log(3,"removed pid file"); X unlink("$socketname"); X do_log(3,"removed socket"); X- while (wait>=0) {}; # must wait for children (if still alive) X- # to get their status by the $SIG{CHLD} handler X- report_children(); X } X X ($DO_SYSLOG eq "yes") ? closelog() : $log->close(); END-of-patch-aa exit alpha# ls -R CVS patch-aa.sha pkg-install Makefile patch-ab.sha pkg-plist Makefile.new patch-za pkg-plist.milter configure patch-zb work distinfo pkg-comment files pkg-descr alpha# cat patch-aa.sha # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # patch-aa # echo x - patch-aa sed 's/^X//' >patch-aa << 'END-of-patch-aa' X--- amavis/amavisd.in.orig 2002-05-13 19:52:15.000000000 +0100 X+++ amavis/amavisd.in 2002-06-09 19:04:25.878040968 +0100 X@@ -123,7 +123,7 @@ X # X # Client/server/daemon related X X-my ($socketname, $parentpid, $tmppid) = ("@sockname@", 0, 0); X+my ($socketname, $parentpid, $diedpid, $tmppid) = ("@sockname@", 0, 0, 0); X X # flag to indicate compressing file format X my $some_compression = 0; X@@ -167,20 +167,22 @@ X # X # Set up signal handling X X-my(%child_status,%child_stime,%child_etime); X- X # X # SIGCHLD handler X sub deadbabe { X- for (;;) { X- my $childpid = wait; X- last if $childpid < 0; X- $child_status{$childpid} = $?; X- $child_etime{$childpid} = time; X- } X+ do { X+ $tmppid = waitpid(-1, &WNOHANG); X+ } while ($tmppid > 0); X+ $diedpid = 1; X $SIG{CHLD} = \&deadbabe; X+# stupid sys5 resets the signal when called - but only -after- the wait... X } X-$SIG{CHLD} = \&deadbabe; X+# Catch any dead child process X+ X+# If IGNORE leaves zombies behind on your system, X+# switch the comments between the two lines below X+# $SIG{CHLD} = \&deadbabe; X+$SIG{CHLD} = 'IGNORE'; X X # may need to do more - eg. if logging changes, close/reopen syslog/log file X # rethink - handler should be simple X@@ -240,15 +242,16 @@ X sub main_loop() { X my ($inbuff, $mpid, $a); X X- for (;;) { X- $a = accept(Client,Server); X+ while (($a = accept(Client,Server)) || $diedpid) { X X do_log(3,"enter accept loop"); X- report_children(); X- X- # if the accept returned purely because of a caught X- # sigchld, then continue X- next unless $a; X+ # now we start the repeating loop... X+ if ($diedpid) { X+ $diedpid = 0; X+ # if the accept returned purely because of a caught sigchld X+ # then continue X+ next unless (defined($a)); X+ } X X if (!defined($mpid = fork)) { X shutdown Server, 2; X@@ -257,12 +260,12 @@ X } X X # if we're the parent, just go back to the accept loop X- if ($mpid) { # we are the parent X- $child_stime{$mpid} = time; X- next; # just go back to the accept loop X- } X- $SIG{CHLD} = undef; X- do_log(3,"forked off -- child [$$] running..."); X+ next if ($mpid); X+ X+ do_log(3,"forked off -- child running..."); X+ X+ $SIG{CHLD} = 'DEFAULT'; X+ # reset sigchild - we don't want to mess up $? for the virus scanner X X # X # Receive TEMPDIR/SENDER/RCPTS/LDA/LDAARGS from client X@@ -1326,9 +1329,6 @@ X do_log(3,"removed pid file"); X unlink("$socketname"); X do_log(3,"removed socket"); X- while (wait>=0) {}; # must wait for children (if still alive) X- # to get their status by the $SIG{CHLD} handler X- report_children(); X } X X ($DO_SYSLOG eq "yes") ? closelog() : $log->close(); END-of-patch-aa exit # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # patch-ab # echo x - patch-ab sed 's/^X//' >patch-ab << 'END-of-patch-ab' X*** amavis/amavisd.in.orig Wed Jun 12 18:21:56 2002 X--- amavis/amavisd.in Wed Jun 12 18:22:32 2002 X*************** X*** 167,172 **** X--- 167,174 ---- X # X # Set up signal handling X X+ my(%child_status,%child_stime,%child_etime); X+ X # X # SIGCHLD handler X sub deadbabe { END-of-patch-ab exit To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208082140.g78Le44c018236>