Fixed bug #44667: Reaping children should be done closer to child death.

This commit is contained in:
Ole Tange 2015-03-30 17:50:38 +02:00
parent 0bf3464301
commit 0094c81f9b
2 changed files with 7 additions and 2 deletions

View file

@ -235,6 +235,8 @@ taxator-tk http://algbio.cs.uni-duesseldorf.de/webapps/wa-download/ (check it)
* GNU Parallel was used in: https://github.com/exascience/elprep * GNU Parallel was used in: https://github.com/exascience/elprep
* Pictures and Metadata http://www.ozzy.no/2015/02/05/pictures-and-metadata/
* Add an ENVI header to JAXA Global Mangrove Watch PALSAR tiles https://spectraldifferences.wordpress.com/2015/03/24/add-an-envi-header-to-jaxa-global-mangrove-watch-palsar-tiles/ * Add an ENVI header to JAXA Global Mangrove Watch PALSAR tiles https://spectraldifferences.wordpress.com/2015/03/24/add-an-envi-header-to-jaxa-global-mangrove-watch-palsar-tiles/
* GNU Parallel (Sebuah Uji Coba) http://kaka.prakasa.my.id/2014/09/04/gnu-parallel-sebuah-uji-coba/ * GNU Parallel (Sebuah Uji Coba) http://kaka.prakasa.my.id/2014/09/04/gnu-parallel-sebuah-uji-coba/

View file

@ -2003,7 +2003,7 @@ sub drain_job_queue {
$sleep = $sleep/2+0.001; $sleep = $sleep/2+0.001;
} }
} }
# Sometimes SIGCHLD is not registered, so force reaper # Exponential back-off sleeping
$sleep = ::reap_usleep($sleep); $sleep = ::reap_usleep($sleep);
} }
if(not $Global::JobQueue->empty()) { if(not $Global::JobQueue->empty()) {
@ -2886,6 +2886,9 @@ sub save_original_signal_handler {
unlink keys %Global::unlink; exit -1 }; unlink keys %Global::unlink; exit -1 };
%Global::original_sig = %SIG; %Global::original_sig = %SIG;
$SIG{TERM} = sub {}; # Dummy until jobs really start $SIG{TERM} = sub {}; # Dummy until jobs really start
# When a child dies, wake up from sleep (or select(,,,))
$SIG{CHLD} = sub { kill "ALRM", $$ };
$SIG{ALRM} = 'IGNORE';
} }
sub list_running_jobs { sub list_running_jobs {
@ -3551,7 +3554,7 @@ sub reap_usleep {
$job->print(); $job->print();
} }
} }
# Sleep exponentially longer (1.1^n) if a job did not finish # Sleep exponentially longer (1.1^n) if a job did not finish,
# though at most 1000 ms. # though at most 1000 ms.
return (($ms < 1000) ? ($ms * 1.1) : ($ms)); return (($ms < 1000) ? ($ms * 1.1) : ($ms));
} }