[svk-commit] r2304 - in trunk: lib/SVK/Mirror/Backend
nobody at bestpractical.com
nobody at bestpractical.com
Sat Mar 3 16:09:39 EST 2007
Author: clkao
Date: Sat Mar 3 16:09:38 2007
New Revision: 2304
Modified:
trunk/ (props changed)
trunk/lib/SVK/Mirror/Backend/SVNRaPipe.pm
Log:
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.
Modified: trunk/lib/SVK/Mirror/Backend/SVNRaPipe.pm
==============================================================================
--- trunk/lib/SVK/Mirror/Backend/SVNRaPipe.pm (original)
+++ trunk/lib/SVK/Mirror/Backend/SVNRaPipe.pm Sat Mar 3 16:09:38 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,12 @@
my $baton_map = {};
my $baton_pool = {};
- while (my $data = $self->read_msg) {
+ local $SIG{INT} = sub { kill 15, $self->pid;
+ waitpid($self->pid, 0);
+ die loc("Interrupted.\n") };
+ 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 +280,12 @@
$baton_map->{$next} = $ret
}
}
+ };
+
+ # 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