[svk-commit] r2339 - branches/2.0-releng/lib/SVK/Mirror/Backend

nobody at bestpractical.com nobody at bestpractical.com
Wed Mar 14 20:31:16 EDT 2007


Author: clkao
Date: Wed Mar 14 20:31:16 2007
New Revision: 2339

Modified:
   branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRaPipe.pm

Log:
Merge from trunk:
 r2304 at trunk:  clkao | 2007-03-03 21:09:38 +0000
  r7482 at ubuntu:  clkao | 2007-03-03 18:31:31 +0000
  In pipelined replay, make perl don't segfault on SIGINT:
  * Make the child ingore SIGINT and wait for parent to SIGTERM it.
  * In the parent, destroy the pools that became default in proper order.
  
 r2305 at trunk:  clkao | 2007-03-04 19:29:31 +0000
 Simplify the SIGINT handling logic in pipelined mirror.
 Also kill the child process when parent is exiting prematurely.
 


Modified: branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRaPipe.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRaPipe.pm	(original)
+++ branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRaPipe.pm	Wed Mar 14 20:31:16 2007
@@ -60,6 +60,7 @@
 use SVK::Editor::Serialize;
 use SVK::Util qw(slurp_fh);
 use SVK::Config;
+use SVK::I18N;
 
 =head1 NAME
 
@@ -114,6 +115,7 @@
     my $max_editor_in_buf
         = $config ? $config->{config}->get( 'svk', 'ra-pipeline-buffer', '5' ) : 5;
     my $pool = SVN::Pool->new_default;
+    local $SIG{INT} = 'IGNORE';
     while ( my $req = $gen->() ) {
         $pool->clear;
         my ( $cmd, @arg ) = @$req;
@@ -209,7 +211,7 @@
 sub read_msg {
     my $self = shift;
     my ($len, $msg);
-    read $self->fh, $len, 4 or die $!;
+    read $self->fh, $len, 4 or Carp::confess $!;
     $len = unpack ('N', $len);
     my $rlen = read $self->fh, $msg, $len or die $!;
     return \$msg;
@@ -246,7 +248,9 @@
     my $baton_map = {};
     my $baton_pool = {};
 
-    while (my $data = $self->read_msg) {
+    eval {
+
+    while ((my $data = $self->read_msg )) {
 	my ($next, $func, @arg) = @{thaw($$data)};
 	my $baton_at = SVK::Editor->baton_at($func);
 	my $baton = $arg[$baton_at];
@@ -273,6 +277,19 @@
 	    $baton_map->{$next} = $ret
 	}
     }
+    };
+
+    if ($@) {
+	kill 15, $self->pid;
+	waitpid $self->pid, 0;
+	$self->pid(undef);
+    }
+
+    # destroy the remaining pool that became default pools in order.
+    delete $baton_pool->{$_} 
+        for reverse sort keys %$baton_pool;
+
+    die $@ if $@;
 }
 
 sub emit_editor_call {


More information about the svk-commit mailing list