From 59ddc7b75dca9abf9d5c104d5c1a13f8f4bbb6a6 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sat, 21 May 2011 08:42:10 +0200 Subject: [PATCH] parallel: Fixed https://savannah.gnu.org/bugs/index.php?33352 Passes testsuite. --- src/parallel | 2 ++ testsuite/tests-to-run/test59.sh | 26 ++++++++++++++++++++++++++ testsuite/wanted-results/sql01 | 4 ++-- testsuite/wanted-results/test59 | 8 ++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100755 testsuite/tests-to-run/test59.sh create mode 100644 testsuite/wanted-results/test59 diff --git a/src/parallel b/src/parallel index 041f99d6..ab603655 100755 --- a/src/parallel +++ b/src/parallel @@ -121,6 +121,7 @@ sub spreadstdin { while(read(STDIN,substr($buf,length $buf,0),$::opt_blocksize)) { # substr above = append to $buf + reap_if_needed(); # Re-enable reaping after read() (Bug#33352) if($::opt_regexp) { if($Global::max_number_of_args) { # -N => (start..*?end){n} @@ -160,6 +161,7 @@ sub spreadstdin { } } } + do_not_reap(); # Disable reaping before read(STDIN) (Bug#33352) } # If there is anything left in the buffer write it write_record_to_pipe(\$buf,$recstart,$recend); diff --git a/testsuite/tests-to-run/test59.sh b/testsuite/tests-to-run/test59.sh new file mode 100755 index 00000000..7e8015e1 --- /dev/null +++ b/testsuite/tests-to-run/test59.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +echo '### Test bug https://savannah.gnu.org/bugs/index.php?33352' + +# produce input slowly to parallel so that it will reap a process +# while blocking in read() + +MD5=md5sum +PAR="parallel -j2 --pipe --keeporder --block 150000 --tmpdir=/dev/shm" +perl -e '@x=1 .. 17000; for(1..100) { print "@x\n"}' | md5sum +nice nice perl -e '@x=1 .. 17000; for(1..100) { print "@x\n"}' | pv -qL 1000000 | \ + $PAR cat | md5sum & +nice nice perl -e '@x=1 .. 17000; for(1..100) { print "@x\n"}' | pv -qL 1000000 | \ + $PAR --recend '' cat | md5sum & +nice nice perl -e '@x=1 .. 17000; for(1..100) { print "@x\n"}' | pv -qL 1000000 | \ + $PAR --recend '' --files cat | parallel -Xj1 cat {}';'rm {} | md5sum & +nice nice perl -e '@x=1 .. 17000; for(1..100) { print "@x\n"}' | pv -qL 1000000 | \ + $PAR --recend '' --files cat | parallel -Xj1 cat {}';'rm {} | md5sum & +nice nice perl -e '@x=1 .. 17000; for(1..100) { print "@x\n"}' | pv -qL 1000000 | \ + $PAR --recend '' --files --tmpdir /dev/shm cat | parallel -Xj1 cat {}';'rm {} | md5sum & +nice nice perl -e '@x=1 .. 17000; for(1..100) { print "@x\n"}' | pv -qL 1000000 | \ + $PAR --recend '' --files --halt-on-error 2 cat | parallel -Xj1 cat {}';'rm {} | md5sum & +wait + + + diff --git a/testsuite/wanted-results/sql01 b/testsuite/wanted-results/sql01 index f7f22b71..b6ace3ab 100644 --- a/testsuite/wanted-results/sql01 +++ b/testsuite/wanted-results/sql01 @@ -51,8 +51,8 @@ mysql -C --host=localhost --user=sqlunittest --port=3306 --password=CB5A1FFF Test if --debug works Yes it does ### Test --version -V - 7 43 306 - 7 43 306 + 12 74 500 + 12 74 500 ### Test -r dburl pg://nongood@127.0.0.3:2227/ databasedriver pg user nongood password host 127.0.0.3 port 2227 database query diff --git a/testsuite/wanted-results/test59 b/testsuite/wanted-results/test59 new file mode 100644 index 00000000..943c4173 --- /dev/null +++ b/testsuite/wanted-results/test59 @@ -0,0 +1,8 @@ +### Test bug https://savannah.gnu.org/bugs/index.php?33352 +350eda13a37912d755c9d733d149bdaf - +350eda13a37912d755c9d733d149bdaf - +350eda13a37912d755c9d733d149bdaf - +350eda13a37912d755c9d733d149bdaf - +350eda13a37912d755c9d733d149bdaf - +350eda13a37912d755c9d733d149bdaf - +350eda13a37912d755c9d733d149bdaf -