Date: Mon, 2 Sep 2013 19:00:25 +0000 (UTC) From: Andrej Zverev <az@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r326056 - in head/mail/p5-Mail-SpamAssassin: . files Message-ID: <201309021900.r82J0PeC067088@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: az Date: Mon Sep 2 19:00:24 2013 New Revision: 326056 URL: http://svnweb.freebsd.org/changeset/ports/326056 Log: - Fix issue when spamd crashes because of memory problems in Logger.pm For more details see Bug 6745 - Do not bump portrevision since issue not global While I'm here: - convert to the new perl5 framework PR: ports/181242 Submitted by: Igor Roshchin <spamd-pr@str.komkon.org> Tested by: Igor Roshchin <spamd-pr@str.komkon.org> (two weeks) Approved by: maintainer (timeout) Added: head/mail/p5-Mail-SpamAssassin/files/patch-bug6745 (contents, props changed) Modified: head/mail/p5-Mail-SpamAssassin/Makefile Modified: head/mail/p5-Mail-SpamAssassin/Makefile ============================================================================== --- head/mail/p5-Mail-SpamAssassin/Makefile Mon Sep 2 18:52:48 2013 (r326055) +++ head/mail/p5-Mail-SpamAssassin/Makefile Mon Sep 2 19:00:24 2013 (r326056) @@ -25,7 +25,8 @@ RUN_DEPENDS:= ${BUILD_DEPENDS} CONFLICTS?= ja-p5-Mail-SpamAssassin-[0-9]* p5-Mail-SpamAssassin-devel-[0-9]* p5-Mail-SpamAssassin-Alt-[0-9]* -PERL_CONFIGURE= 5.12+ +USES= perl5 +USE_PERL5= configure USE_LDCONFIG= yes DBDIR?= /var/db ETCDIR?= ${PREFIX}/etc/mail/spamassassin Added: head/mail/p5-Mail-SpamAssassin/files/patch-bug6745 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/mail/p5-Mail-SpamAssassin/files/patch-bug6745 Mon Sep 2 19:00:24 2013 (r326056) @@ -0,0 +1,106 @@ +--- lib/Mail/SpamAssassin/Logger/Syslog.pm 2012/05/14 16:28:23 1338277 ++++ lib/Mail/SpamAssassin/Logger/Syslog.pm 2012/05/14 16:31:09 1338278 +@@ -167,17 +167,21 @@ + } + $msg = $timestamp . ' ' . $msg if $timestamp ne ''; + +- # important: do not call syslog() from the SIGCHLD handler +- # child_handler(). otherwise we can get into a loop if syslog() +- # forks a process -- as it does in syslog-ng apparently! (bug 3625) +- $Mail::SpamAssassin::Logger::LOG_SA{INHIBIT_LOGGING_IN_SIGCHLD_HANDLER} = 1; ++# no longer needed since a patch to bug 6745: ++# # important: do not call syslog() from the SIGCHLD handler ++# # child_handler(). otherwise we can get into a loop if syslog() ++# # forks a process -- as it does in syslog-ng apparently! (bug 3625) ++# $Mail::SpamAssassin::Logger::LOG_SA{INHIBIT_LOGGING_IN_SIGCHLD_HANDLER} = 1; ++ + my $eval_stat; + eval { + syslog($level, "%s", $msg); 1; + } or do { + $eval_stat = $@ ne '' ? $@ : "errno=$!"; chomp $eval_stat; + }; +- $Mail::SpamAssassin::Logger::LOG_SA{INHIBIT_LOGGING_IN_SIGCHLD_HANDLER} = 0; ++ ++# no longer needed since a patch to bug 6745: ++# $Mail::SpamAssassin::Logger::LOG_SA{INHIBIT_LOGGING_IN_SIGCHLD_HANDLER} = 0; + + if (defined $eval_stat) { + if ($self->check_syslog_sigpipe($msg)) { +--- spamd/spamd.raw 2012/05/14 16:28:23 1338277 ++++ spamd/spamd.raw 2012/05/14 16:31:09 1338278 +@@ -589,6 +589,7 @@ + my $timeout_child; # processing timeout (headers->finish), 0=no timeout + my $clients_per_child; # number of clients each child should process + my %children; # current children ++my @children_exited; + + if ( defined $opt{'max-children'} ) { + $childlimit = $opt{'max-children'}; +@@ -1033,6 +1034,8 @@ + # child_handler() if !$scaling || am_running_on_windows(); + child_handler(); # it doesn't hurt to call child_handler unconditionally + ++ child_cleaner(); ++ + do_sighup_restart() if defined $got_sighup; + + for (my $i = keys %children; $i < $childlimit; $i++) { +@@ -2523,7 +2526,8 @@ + my ($sig) = @_; + + # do NOT call syslog here unless the child's pid is in our list of known +- # children. This is due to syslog-ng brokenness -- bugs 3625, 4237. ++ # children. This is due to syslog-ng brokenness -- bugs 3625, 4237; ++ # see also bug 6745. + + # clean up any children which have exited + for (;;) { +@@ -2534,12 +2538,23 @@ + # + my $pid = waitpid(-1, WNOHANG); + last if !$pid || $pid == -1; +- my $child_stat = $?; ++ push(@children_exited, [$pid, $?, $sig, time]); ++ } + +- if (!defined $children{$pid}) { +- # ignore this child; we didn't realise we'd forked it. bug 4237 +- next; +- } ++ $SIG{CHLD} = \&child_handler; # reset as necessary, should be at end ++} ++ ++# takes care of dead children, as noted by a child_handler() ++# called in a main program flow (not from a signal handler) ++# ++sub child_cleaner { ++ while (@children_exited) { ++ my $tuple = shift(@children_exited); ++ next if !$tuple; # just in case ++ my($pid, $child_stat, $sig, $timestamp) = @$tuple; ++ ++ # ignore this child if we didn't realise we'd forked it. bug 4237 ++ next if !defined $children{$pid}; + + # remove them from our child listing + delete $children{$pid}; +@@ -2550,15 +2565,10 @@ + my $sock = $backchannel->get_socket_for_child($pid); + if ($sock) { $sock->close(); } + } +- +- unless ($Mail::SpamAssassin::Logger::LOG_SA{INHIBIT_LOGGING_IN_SIGCHLD_HANDLER}) { +- info("spamd: handled cleanup of child pid [%s]%s: %s", +- $pid, (defined $sig ? " due to SIG$sig" : ""), +- exit_status_str($child_stat,0)); +- } ++ info("spamd: handled cleanup of child pid [%s]%s: %s", ++ $pid, (defined $sig ? " due to SIG$sig" : ""), ++ exit_status_str($child_stat,0)); + } +- +- $SIG{CHLD} = \&child_handler; # reset as necessary, should be at end + } + + sub restart_handler {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309021900.r82J0PeC067088>