[SCM] Interchange branch, master, updated. 1d9dbfb4e42ecf7e1fcf81cf931d7d4794f46f73

Jon Jensen <[email protected]>
Newsgroups gmane.comp.web.interchange.cvs
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Interchange".

The branch, master has been updated
       via  1d9dbfb4e42ecf7e1fcf81cf931d7d4794f46f73 (commit)
      from  e993135f285fe9739473115eec5970d859cdf134 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1d9dbfb4e42ecf7e1fcf81cf931d7d4794f46f73
Author: Mark Johnson <[email protected]>
Date:   Tue Sep 1 14:53:37 2009 -0600

    Fix problem restarting daemon in PreFork mode
    
    Previously, restart was failing, stating it couldn't find the previous
    Interchange running, and would keep creating StartServers new servers on
    every restart. Only SIGKILL was able to kill all PreFork children.
    
    The original code was just being stupid (and I can say that freely
    since I wrote it). I had in my head that as child PIDs died, %Page_pids
    and %Starting_pids would be culled. However, that process only happens
    through normal operations (housekeeping, ChildLife or MRPC, etc.)--not
    when I send the kid a TERM!

-----------------------------------------------------------------------

Summary of changes and diff:
 lib/Vend/Server.pm |   31 ++++++++++---------------------
 1 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/lib/Vend/Server.pm b/lib/Vend/Server.pm
index 3c59e2f..2ffa592 100644
--- a/lib/Vend/Server.pm
+++ b/lib/Vend/Server.pm
@@ -1055,31 +1055,20 @@ my ($Sig_inc, $Sig_dec, $Counter);
 sub sig_int_or_term {
 	$Signal_Terminate = 1;
 
-	my $term_count = 0;
-	TERM: {
-		my %seen;
-		my @pids =
-			grep { !$seen{$_}++ }
-				(keys %Page_pids, keys %Starting_pids);
+	my (%seen, $all_gone);
 
-		last TERM unless @pids;
+	my @pids =
+		grep { !$seen{$_}++ }
+			(keys %Page_pids, keys %Starting_pids);
 
-		kill TERM => $_ for @pids;
-		sleep 1;
-
-		redo TERM unless ++$term_count > 3;
+	for (1..3) {
+		$all_gone = ! kill TERM => @pids
+			and last;
+		select (undef, undef, undef, 0.5);
 	}
 
-	KILL: {
-		my %seen;
-		my @pids =
-			grep { !$seen{$_}++ }
-				(keys %Page_pids, keys %Starting_pids);
-
-		last KILL unless @pids;
-
-		kill KILL => $_ for @pids;
-	}
+	kill KILL => @pids
+		unless $all_gone;
 
 	return;
 }


hooks/post-receive
-- 
Interchange
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.