add a FETCH_TIMEOUT, similar to STUCK_TIMEOUT, but slightly simpler,

as there is no speed factor there...
This commit is contained in:
espie 2013-01-28 12:23:45 +00:00
parent c162d4f3bf
commit 573c499cf5
3 changed files with 22 additions and 3 deletions

View File

@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
# $OpenBSD: dpb,v 1.81 2013/01/28 10:50:46 espie Exp $
# $OpenBSD: dpb,v 1.82 2013/01/28 12:23:45 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -270,6 +270,10 @@ sub start_cores
$override_prop->{stuck} =
$state->{subst}->value('STUCK_TIMEOUT');
}
if ($state->define_present('FETCH_TIMEOUT')) {
$override_prop->{fetch_timeout} =
$state->{subst}->value('FETCH_TIMEOUT');
}
if ($state->define_present('SMALL_TIME')) {
$override_prop->{small} =
$state->{subst}->value('SMALL_TIME');

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Core.pm,v 1.31 2013/01/28 10:14:17 espie Exp $
# $OpenBSD: Core.pm,v 1.32 2013/01/28 12:23:45 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -180,6 +180,12 @@ sub stuck_timeout
return $self->prop->{stuck_timeout};
}
sub fetch_timeout
{
my $self = shift;
return $self->prop->{fetch_timeout};
}
sub memory
{
my $self = shift;

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Fetch.pm,v 1.47 2013/01/28 10:50:46 espie Exp $
# $OpenBSD: Fetch.pm,v 1.48 2013/01/28 12:23:45 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -832,6 +832,15 @@ sub watched
my ($self, $current, $core) = @_;
my $diff = $self->{watched}->check_change($current);
my $msg = $self->{watched}->change_message($diff);
my $to = $core->fetch_timeout;
if (defined $to) {
if ($diff > $to) {
$self->{stuck} =
"KILLED: $self->{current} stuck at $msg";
kill 9, $core->{pid};
return $self->{stuck};
}
}
return $msg;
}