On Thu, Jun 08, 2006 at 01:25:16PM +0200, Goswin von Brederlow wrote: > Wouter Verhelst <wouter@debian.org> writes: > > In other words, I feel that the timeout code is doing more harm than it > > is helping. Wouldn't it be better if we would just drop the timeout > > code? [...] > For m68k I totaly agree with you that killing the job is probably > doing more harm than good. Maybe instead of killing the job the buildd > could send a mail to the admin to look into the matter instead. The > admin can then kill the job or let it run and set a package specific > timeout for the next time. So I gave this some thought, and came up with the following patch (against current svn trunk). Comments are welcome. Index: sbuild =================================================================== --- sbuild (revision 99) +++ sbuild (working copy) @@ -754,12 +754,36 @@ my $timed_out = 0; my(@timeout_times, @timeout_sigs, $last_time); $SIG{'ALRM'} = sub { - my $signal = ($timed_out > 0) ? 9 : 15; - system "$conf::sudo perl -e 'kill( -$signal, $main::sub_pid )'"; $timeout_times[$timed_out] = time - $last_time; $timeout_sigs[$timed_out] = $signal; + if($timed_out < 2 && -f "$main::HOME/NO-KILL-PLEASE") { + unlink "$main::HOME/NO-KILL-PLEASE"; + $timed_out=0; + } + if(!$timed_out) { + # This is an ugly and insecure way to create a + # tempfile, but I don't think it's proper to add an + # extra module (File::Temp) for just these few lines... + # though I'm happy to be corrected :) -- Wouter + open(TEMPFILE, ">mail-temp"); + print TEMPFILE <<EOF +Warning: sbuild has seen no output from the current build proces in $timeout_times[$timed_out] +minutes. If nothing is done, the current build process will be killed in +another $timeout minutes. + +If you want to prevent sbuild from killing the build, please create a file +$main::HOME/NO-KILL-PLEASE. Note that if such a file existed previously, it +has now been removed. +EOF + close(TEMPFILE); + send_mail( $conf::mailto, "Sbuild timeout warning", "mail-temp"); + unlink "mail-temp"; + } else { + my $signal = ($timed_out > 1) ? 9 : 15; + system "$conf::sudo perl -e 'kill( -$signal, $main::sub_pid )'"; + $timeout = 5*60; # only wait 5 minutes until next signal + } $timed_out++; - $timeout = 5*60; # only wait 5 minutes until next signal }; alarm( $timeout ); @@ -774,7 +798,7 @@ $rv = $?; my $i; - for( $i = 0; $i < $timed_out; ++$i ) { + for( $i = 1; $i < $timed_out; ++$i ) { print PLOG "Build killed with signal ", $timeout_sigs[$i], " after ", int($timeout_times[$i]/60), " minutes of inactivity\n"; -- Fun will now commence -- Seven Of Nine, "Ashes to Ashes", stardate 53679.4
Attachment:
signature.asc
Description: Digital signature