mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 14:07:55 +00:00
parallel: bug #41412: --timeout + --delay causes deadlock.
This commit is contained in:
parent
db6017675b
commit
c1e6d7962e
17
src/parallel
17
src/parallel
|
@ -1439,6 +1439,10 @@ sub start_more_jobs {
|
|||
# It has been too short since
|
||||
next;
|
||||
}
|
||||
if($opt::delay and $opt::delay > ::now() - $Global::newest_starttime) {
|
||||
# It has been too short since
|
||||
next;
|
||||
}
|
||||
debug($sshlogin->string()." has ".$sshlogin->jobs_running()
|
||||
. " out of " . $sshlogin->max_jobs_running()
|
||||
. " jobs running. Start another.\n");
|
||||
|
@ -1495,7 +1499,6 @@ sub start_another_job {
|
|||
($opt::results and $opt::resume and $job->is_already_in_results()));
|
||||
debug("Command to run on '".$job->sshlogin()->string()."': '".$job->replaced()."'\n");
|
||||
if($job->start()) {
|
||||
$Global::running{$job->pid()} = $job;
|
||||
if($opt::pipe) {
|
||||
push(@Global::virgin_jobs,$job);
|
||||
}
|
||||
|
@ -2272,7 +2275,6 @@ sub reaper {
|
|||
$sshlogin->inc_jobs_completed();
|
||||
$Global::total_running--;
|
||||
delete $Global::running{$stiff};
|
||||
start_more_jobs();
|
||||
}
|
||||
debug("done ");
|
||||
return $children_reaped;
|
||||
|
@ -2545,6 +2547,9 @@ sub reap_usleep {
|
|||
# Sleep exponentially shorter (1/2^n) if a job finished
|
||||
return $ms/2+0.001;
|
||||
} else {
|
||||
if($opt::timeout) {
|
||||
$Global::timeoutq->process_timeouts();
|
||||
}
|
||||
usleep($ms);
|
||||
Job::exit_if_disk_full();
|
||||
if($opt::linebuffer) {
|
||||
|
@ -2563,9 +2568,6 @@ sub usleep {
|
|||
my $secs = shift;
|
||||
::debug(int($secs),"ms ");
|
||||
select(undef, undef, undef, $secs/1000);
|
||||
if($opt::timeout) {
|
||||
$Global::timeoutq->process_timeouts();
|
||||
}
|
||||
}
|
||||
|
||||
sub now {
|
||||
|
@ -4786,13 +4788,12 @@ sub start {
|
|||
$Global::total_started++;
|
||||
$job->set_pid($pid);
|
||||
$job->set_starttime();
|
||||
$Global::running{$job->pid()} = $job;
|
||||
if($opt::timeout) {
|
||||
$Global::timeoutq->insert($job);
|
||||
}
|
||||
if($opt::delay) {
|
||||
$Global::JobQueue->empty() or ::usleep($opt::delay*1000);
|
||||
}
|
||||
$Global::newest_job = $job;
|
||||
$Global::newest_starttime = ::now();
|
||||
return $job;
|
||||
} else {
|
||||
# No more processes
|
||||
|
|
|
@ -6,6 +6,11 @@ XAP="nice nice parallel --xapply"
|
|||
export XAP
|
||||
|
||||
cat <<'EOF' | sed -e 's/$SERVER1/'$SERVER1'/;s/$SERVER2/'$SERVER2'/' | stdout parallel -j0 -k -L1
|
||||
echo 'bug #41412: --timeout + --delay causes deadlock';
|
||||
seq 10 | parallel -j10 --timeout 1 --delay .3 echo
|
||||
parallel -j3 --timeout 1 --delay 2 echo ::: 1 2 3
|
||||
parallel -j10 --timeout 2.2 --delay 3 "sleep {}; echo {}" ::: 1 2 4 5 6
|
||||
|
||||
echo '### Test --spreadstdin - more procs than args';
|
||||
rm -f /tmp/parallel.ss.*;
|
||||
seq 1 5 | stdout parallel -j 10 --spreadstdin 'cat >/tmp/parallel.ss.$PARALLEL_SEQ' >/dev/null;
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
bug #41412: --timeout + --delay causes deadlock
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
### Test --spreadstdin - more procs than args
|
||||
1
|
||||
2
|
||||
|
|
Loading…
Reference in a new issue