parallel: Fixed bug #53748: -k --retries 10 + out of filehandles = blocking.

This commit is contained in:
Ole Tange 2018-04-25 22:38:42 +02:00
parent 9a1d2e9dad
commit 1422b7b43a
3 changed files with 28 additions and 1 deletions

View file

@ -2729,6 +2729,7 @@ sub init_run_jobs {
$no_more_file_handles_warned++ or $no_more_file_handles_warned++ or
::warning("No more file handles. ", ::warning("No more file handles. ",
"Raising ulimit -n or /etc/security/limits.conf may help."); "Raising ulimit -n or /etc/security/limits.conf may help.");
debug("start", "No more file handles. ");
return 0; return 0;
} }
} }
@ -3973,7 +3974,9 @@ sub reaper {
} }
my $sshlogin = $job->sshlogin(); my $sshlogin = $job->sshlogin();
$sshlogin->dec_jobs_running(); $sshlogin->dec_jobs_running();
if(not $job->should_be_retried()) { if($job->should_be_retried()) {
$job->free_ressources();
} else {
# The job is done # The job is done
$sshlogin->inc_jobs_completed(); $sshlogin->inc_jobs_completed();
# Free the jobslot # Free the jobslot
@ -9126,6 +9129,14 @@ sub print_tag {
return print_normal(@_); return print_normal(@_);
} }
sub free_ressources() {
my $self = shift;
for my $fdno (sort { $a <=> $b } keys %Global::fd) {
close $self->fh($fdno,"w");
close $self->fh($fdno,"r");
}
}
sub print_normal { sub print_normal {
my $self = shift; my $self = shift;
my ($fdno,$in_fh,$out_fd) = @_; my ($fdno,$in_fh,$out_fd) = @_;

View file

@ -299,6 +299,13 @@ par_linebuffer_tag_slow_output() {
parallel --delay 1 -j0 --tag --line-buffer halfline ::: a b parallel --delay 1 -j0 --tag --line-buffer halfline ::: a b
} }
par_retries_all_fail() {
echo "bug #53748: -k --retries 10 + out of filehandles = blocking"
ulimit -n 30
seq 8 |
parallel -k -j0 --retries 2 --timeout 0.1 'echo {}; sleep {}; false' 2>/dev/null
}
export -f $(compgen -A function | grep par_) export -f $(compgen -A function | grep par_)
compgen -A function | grep par_ | sort | compgen -A function | grep par_ | sort |
parallel --joblog /tmp/jl-`basename $0` -j10 --tag -k '{} 2>&1' parallel --joblog /tmp/jl-`basename $0` -j10 --tag -k '{} 2>&1'

View file

@ -506,6 +506,15 @@ par_results_csv 8,:,999.999,999.999,0,6,0,0,"echo 23 11",23,11,"23 11
par_results_csv ", par_results_csv ",
par_results_csv 9,:,999.999,999.999,0,6,0,0,"echo 23 12",23,12,"23 12 par_results_csv 9,:,999.999,999.999,0,6,0,0,"echo 23 12",23,12,"23 12
par_results_csv ", par_results_csv ",
par_retries_all_fail bug #53748: -k --retries 10 + out of filehandles = blocking
par_retries_all_fail 1
par_retries_all_fail 2
par_retries_all_fail 3
par_retries_all_fail 4
par_retries_all_fail 5
par_retries_all_fail 6
par_retries_all_fail 7
par_retries_all_fail 8
par_round_robin_blocks bug #49664: --round-robin does not complete par_round_robin_blocks bug #49664: --round-robin does not complete
par_round_robin_blocks 8 par_round_robin_blocks 8
par_slow_total_jobs bug #51006: Slow total_jobs() eats job par_slow_total_jobs bug #51006: Slow total_jobs() eats job