On 01/04/2012 05:35 PM, Pádraig Brady wrote:
> On 01/04/2012 02:12 PM, Stefano Lattarini wrote:
>
>> The only failed test was `misc/timeout-group'.
>
> This is either a race in the test or a bug in timeout, neither of which I can
> see.
> Your system is running 2.6.30-2-686 SMP
>
> Does this fail all the time?
> (cd tests && make check TESTS=misc/timeout-group VERBOSE=yes)
>
No, it only fails ~ 6% of the time:
$ cat foo.sh
#!/bin/bash
pass=0
fail=0
for ((i = 1; i <= 200; i++)); do
if make -C tests check TESTS=misc/timeout-group VERBOSE=yes &>/dev/null
then
echo "- run $i: pass"
let pass++
else
echo "- run $i: fail"
let fail++
fi
done
echo PASS: $pass
echo FAIL: $fail
$ ./foo.sh
- run 1: fail
- run 2: pass
- run 3: pass
- run 4: pass
- run 5: pass
- run 6: pass
- run 7: pass
- run 8: pass
- run 9: pass
- run 10: fail
- run 11: pass
...
- run 199: pass
- run 200: pass
PASS: 188
FAIL: 12
> Does it fail if you force bash?
> (cd tests && make check TESTS=misc/timeout-group VERBOSE=yes SHELL=/bin/bash)
>
The behaviour is the same as above (as was predictable, since /bin/sh is linked
to /bin/bash).
> If you change timeout.c to fprintf(stderr) that the first
> send_sig (monitored_pid) call is made, does that happen in the failing case?
>
OK, so, in 'timeout.c:cleanup()' I've added this line:
fprintf (stderr, "^^^ send_sig (%lu, %u)\n", monitored_pid, sig);
just before this line:
send_sig (monitored_pid, sig);
The logs of a failing and a passing test run after this modification are
attached.
> As an outside guess, maybe timer_create() causes threads to
> be created on your system, which may in turn cause signal issues?
> Does the failure still happen if you s/HAVE_TIMER_SETTIME/0/ in timeout.c?
>
Yes (after 10 runs the first time I've tried, after 2 the second time,
after 13 the third and last time).
HTH,
Stefano
++ initial_cwd_=/tmp/coreutils-8.14.116-1e18d/tests
++ fail=0
+++ testdir_prefix_
+++ printf gt
++ pfx_=gt
+++ mktempd_ /tmp/coreutils-8.14.116-1e18d/tests gt-timeout-group.XXXX
+++ case $# in
+++ destdir_=/tmp/coreutils-8.14.116-1e18d/tests
+++ template_=gt-timeout-group.XXXX
+++ MAX_TRIES_=4
+++ case $destdir_ in
+++ case $template_ in
++++ unset TMPDIR
++++ mktemp -d -t -p /tmp/coreutils-8.14.116-1e18d/tests gt-timeout-group.XXXX
+++ d=/tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.e0kn
+++ case $d in
+++ test -d /tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.e0kn
++++ ls -dgo /tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.e0kn
++++ tr S -
+++ perms='drwx------ 2 4096 Jan 4 19:11
/tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.e0kn'
+++ case $perms in
+++ test 0 = 0
+++ echo /tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.e0kn
+++ return
++ test_dir_=/tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.e0kn
++ cd /tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.e0kn
++ gl_init_sh_nl_='
'
++ IFS='
'
++ for sig_ in 1 2 3 13 15
+++ expr 1 + 128
++ eval 'trap '\''Exit 129'\'' 1'
+++ trap 'Exit 129' 1
++ for sig_ in 1 2 3 13 15
+++ expr 2 + 128
++ eval 'trap '\''Exit 130'\'' 2'
+++ trap 'Exit 130' 2
++ for sig_ in 1 2 3 13 15
+++ expr 3 + 128
++ eval 'trap '\''Exit 131'\'' 3'
+++ trap 'Exit 131' 3
++ for sig_ in 1 2 3 13 15
+++ expr 13 + 128
++ eval 'trap '\''Exit 141'\'' 13'
+++ trap 'Exit 141' 13
++ for sig_ in 1 2 3 13 15
+++ expr 15 + 128
++ eval 'trap '\''Exit 143'\'' 15'
+++ trap 'Exit 143' 15
++ trap remove_tmp_ 0
+ path_prepend_ ../src
+ test 1 '!=' 0
+ path_dir_=../src
+ case $path_dir_ in
++ cd /tmp/coreutils-8.14.116-1e18d/tests/../src
++ echo /tmp/coreutils-8.14.116-1e18d/src
+ abs_path_dir_=/tmp/coreutils-8.14.116-1e18d/src
+ case $abs_path_dir_ in
+
PATH=/tmp/coreutils-8.14.116-1e18d/src:/tmp/coreutils-8.14.116-1e18d/src:/home/stefano/bin/linux:/home/stefano/bin:/usr/local/bin:/opt/bin:/usr/lib/jvm/java-6-sun-1.6.0.26/bin:/usr/games:/usr/bin:/usr/sbin:/bin:/sbin
+ create_exe_shims_ /tmp/coreutils-8.14.116-1e18d/src
+ case $EXEEXT in
+ return 0
+ shift
+ test 0 '!=' 0
+ export PATH
+ print_ver_ timeout
+ test yes = yes
+ local i
+ for i in '$*'
+ env timeout --version
timeout (GNU coreutils) 8.14.116-1e18d
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Padraig Brady.
+ setsid true
+ cat
+ chmod a+x timeout.cmd
+ cat
+ chmod a+x group.sh
+ setsid ./group.sh
+ retry_delay_ check_timeout_cmd_running .1 6
+ local test_func=check_timeout_cmd_running
+ local init_delay=.1
+ local max_n_tries=6
+ local attempt=1
+ local num_sleeps=1
+ local time_fail
+ test 1 -le 6
++ gawk -v n=1 -v s=.1 'BEGIN { print s * n }'
+ local delay=0.1
+ check_timeout_cmd_running 0.1
+ local delay=0.1
+ test -e timeout.running
+ time_fail=0
+ break
+ test 0 = 0
+ env kill -INT -- -4854
+ wait
^^^ send_sig (4856, 2)
+ test -e int.received
+ rm -f int.received timeout.running
++ date +%s
+ start=1325700700
+ timeout -sALRM 30 timeout -sINT 25 ./timeout.cmd 20
+ pid=4863
+ retry_delay_ check_timeout_cmd_running .1 6
+ local test_func=check_timeout_cmd_running
+ local init_delay=.1
+ local max_n_tries=6
+ local attempt=1
+ local num_sleeps=1
+ local time_fail
+ test 1 -le 6
++ gawk -v n=1 -v s=.1 'BEGIN { print s * n }'
+ local delay=0.1
+ check_timeout_cmd_running 0.1
+ local delay=0.1
+ test -e timeout.running
+ time_fail=0
+ break
+ test 0 = 0
+ kill -ALRM 4863
^^^ send_sig (4864, 14)
+ wait 4863
+ ret=124
+ test 124 -eq 124
+ test -e int.received
+ fail=1
++ date +%s
+ end=1325700700
++ expr 1325700700 - 1325700700
+ test 0 -lt 20
+ Exit 1
+ set +e
+ exit 1
+ exit 1
+ remove_tmp_
+ __st=1
+ cleanup_
+ :
+ cd /tmp/coreutils-8.14.116-1e18d/tests
+ chmod -R u+rwx /tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.e0kn
+ rm -rf /tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.e0kn
+ exit 1
++ initial_cwd_=/tmp/coreutils-8.14.116-1e18d/tests
++ fail=0
+++ testdir_prefix_
+++ printf gt
++ pfx_=gt
+++ mktempd_ /tmp/coreutils-8.14.116-1e18d/tests gt-timeout-group.XXXX
+++ case $# in
+++ destdir_=/tmp/coreutils-8.14.116-1e18d/tests
+++ template_=gt-timeout-group.XXXX
+++ MAX_TRIES_=4
+++ case $destdir_ in
+++ case $template_ in
++++ unset TMPDIR
++++ mktemp -d -t -p /tmp/coreutils-8.14.116-1e18d/tests gt-timeout-group.XXXX
+++ d=/tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.SOKN
+++ case $d in
+++ test -d /tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.SOKN
++++ ls -dgo /tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.SOKN
++++ tr S -
+++ perms='drwx------ 2 4096 Jan 4 19:09
/tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.-OKN'
+++ case $perms in
+++ test 0 = 0
+++ echo /tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.SOKN
+++ return
++ test_dir_=/tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.SOKN
++ cd /tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.SOKN
++ gl_init_sh_nl_='
'
++ IFS='
'
++ for sig_ in 1 2 3 13 15
+++ expr 1 + 128
++ eval 'trap '\''Exit 129'\'' 1'
+++ trap 'Exit 129' 1
++ for sig_ in 1 2 3 13 15
+++ expr 2 + 128
++ eval 'trap '\''Exit 130'\'' 2'
+++ trap 'Exit 130' 2
++ for sig_ in 1 2 3 13 15
+++ expr 3 + 128
++ eval 'trap '\''Exit 131'\'' 3'
+++ trap 'Exit 131' 3
++ for sig_ in 1 2 3 13 15
+++ expr 13 + 128
++ eval 'trap '\''Exit 141'\'' 13'
+++ trap 'Exit 141' 13
++ for sig_ in 1 2 3 13 15
+++ expr 15 + 128
++ eval 'trap '\''Exit 143'\'' 15'
+++ trap 'Exit 143' 15
++ trap remove_tmp_ 0
+ path_prepend_ ../src
+ test 1 '!=' 0
+ path_dir_=../src
+ case $path_dir_ in
++ cd /tmp/coreutils-8.14.116-1e18d/tests/../src
++ echo /tmp/coreutils-8.14.116-1e18d/src
+ abs_path_dir_=/tmp/coreutils-8.14.116-1e18d/src
+ case $abs_path_dir_ in
+
PATH=/tmp/coreutils-8.14.116-1e18d/src:/tmp/coreutils-8.14.116-1e18d/src:/home/stefano/bin/linux:/home/stefano/bin:/usr/local/bin:/opt/bin:/usr/lib/jvm/java-6-sun-1.6.0.26/bin:/usr/games:/usr/bin:/usr/sbin:/bin:/sbin
+ create_exe_shims_ /tmp/coreutils-8.14.116-1e18d/src
+ case $EXEEXT in
+ return 0
+ shift
+ test 0 '!=' 0
+ export PATH
+ print_ver_ timeout
+ test yes = yes
+ local i
+ for i in '$*'
+ env timeout --version
timeout (GNU coreutils) 8.14.116-1e18d
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Padraig Brady.
+ setsid true
+ cat
+ chmod a+x timeout.cmd
+ cat
+ chmod a+x group.sh
+ setsid ./group.sh
+ retry_delay_ check_timeout_cmd_running .1 6
+ local test_func=check_timeout_cmd_running
+ local init_delay=.1
+ local max_n_tries=6
+ local attempt=1
+ local num_sleeps=1
+ local time_fail
+ test 1 -le 6
++ gawk -v n=1 -v s=.1 'BEGIN { print s * n }'
+ local delay=0.1
+ check_timeout_cmd_running 0.1
+ local delay=0.1
+ test -e timeout.running
+ time_fail=0
+ break
+ test 0 = 0
+ env kill -INT -- -32404
+ wait
+ test -e int.received
+ rm -f int.received timeout.running
++ date +%s
+ start=1325700588
+ timeout -sALRM 30 timeout -sINT 25 ./timeout.cmd 20
+ pid=32414
+ retry_delay_ check_timeout_cmd_running .1 6
+ local test_func=check_timeout_cmd_running
+ local init_delay=.1
+ local max_n_tries=6
+ local attempt=1
+ local num_sleeps=1
+ local time_fail
+ test 1 -le 6
++ gawk -v n=1 -v s=.1 'BEGIN { print s * n }'
+ local delay=0.1
+ check_timeout_cmd_running 0.1
+ local delay=0.1
+ test -e timeout.running
+ time_fail=0
+ break
+ test 0 = 0
+ kill -ALRM 32414
^^^ send_sig (32415, 14)
^^^ send_sig (32416, 2)
+ wait 32414
+ ret=124
+ test 124 -eq 124
+ test -e int.received
++ date +%s
+ end=1325700589
++ expr 1325700589 - 1325700588
+ test 1 -lt 20
+ Exit 0
+ set +e
+ exit 0
+ exit 0
+ remove_tmp_
+ __st=0
+ cleanup_
+ :
+ cd /tmp/coreutils-8.14.116-1e18d/tests
+ chmod -R u+rwx /tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.SOKN
+ rm -rf /tmp/coreutils-8.14.116-1e18d/tests/gt-timeout-group.SOKN
+ exit 0