From 0094c81f9b2b6ea55c688c6ac726696fe437a8e9 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Mon, 30 Mar 2015 17:50:38 +0200 Subject: [PATCH] Fixed bug #44667: Reaping children should be done closer to child death. --- doc/release_new_version | 2 ++ src/parallel | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/release_new_version b/doc/release_new_version index 2f64cf75..923d5127 100644 --- a/doc/release_new_version +++ b/doc/release_new_version @@ -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 +* 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/ * GNU Parallel (Sebuah Uji Coba) http://kaka.prakasa.my.id/2014/09/04/gnu-parallel-sebuah-uji-coba/ diff --git a/src/parallel b/src/parallel index ce809771..22e0bc0a 100755 --- a/src/parallel +++ b/src/parallel @@ -2003,7 +2003,7 @@ sub drain_job_queue { $sleep = $sleep/2+0.001; } } - # Sometimes SIGCHLD is not registered, so force reaper + # Exponential back-off sleeping $sleep = ::reap_usleep($sleep); } if(not $Global::JobQueue->empty()) { @@ -2886,6 +2886,9 @@ sub save_original_signal_handler { unlink keys %Global::unlink; exit -1 }; %Global::original_sig = %SIG; $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 { @@ -3551,7 +3554,7 @@ sub reap_usleep { $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. return (($ms < 1000) ? ($ms * 1.1) : ($ms)); }