Subject: Re: bug#21061: coreutils-8.24 - Partially reproducible failures of tests/misc/timeout-parameters.sh

From: Peter Bray <[email-masked]>
Date: Sat, 18 Jul 2015 13:09:18 +1000

On 17/07/15 06:56 PM, Pádraig Brady wrote:
> while true; do time gtimeout 0.1 sleep inf; test $? != 124 && break; done

Run this code on S10U8/32 for almost 12 hours without it stopping 
itself. An almost 10 hours on S10U11/32 with the same result (not 
stopping itself).

Made the requested change to src/timeout.c

Backup  : src/timeout.c.orig
Editted : src/timeout.c

Command : gdiff

139c139
<   if (timer_create (CLOCK_REALTIME, NULL, &timerid) == 0)
---
 >   if (timer_create (CLOCK_MONOTONIC, NULL, &timerid) == 0)

Run as an unprivileged user, gives the following error summary:

% egrep '(FAIL|ERROR) ' tests/test-suite.log | sed -e 's/FAIL /FAIL  /'
FAIL  tests/misc/tee.sh (exit status: 1)
FAIL  tests/misc/timeout-blocked.pl (exit status: 1)
FAIL  tests/tail-2/wait.sh (exit status: 1)
FAIL  tests/tail-2/retry.sh (exit status: 1)
FAIL  tests/tail-2/symlink.sh (exit status: 1)
FAIL  tests/ls/infloop.sh (exit status: 1)
FAIL  tests/tail-2/follow-name.sh (exit status: 1)
FAIL  tests/tail-2/follow-stdin.sh (exit status: 1)

On Solaris 10 Update 8 with Solaris 10 Update 11 and Solaris 11.2 have 
the additional tmpfs build problems mentioned in BUG-21062

With the following executive summary:

% grep "timer_create: Not owner" ./tests/test-suite.log | sort | uniq -c
    1 + timeout: warning: timer_create: Not owner
    7 +timeout: warning: timer_create: Not owner
   29 timeout: warning: timer_create: Not owner

When run as "root" on Solaris 10 Update 8, the attached 
"test-suite.log-monotonic-root" shows that two tests FAIL:

% egrep '(FAIL|ERROR) ' test-suite.log-*-root | sed -e 's/FAIL /FAIL  /'
FAIL  tests/misc/tee.sh (exit status: 1)
FAIL  tests/misc/timeout-parameters.sh (exit status: 1)

With the following section of the attached log, showing a sequence of 
failures (exit status = 124) on the root execution of the checks:

+++ date +%s
++ expr 2147483647 - 1437184440 + 100
+ KERNEL_OVERFLOW_LIMIT=710299307
+ timeout 710299307 sleep 0
+ test 0 '!=' 124
+ timeout 4294967296 sleep 0
+ test 124 = 0
+ fail=1
++ expr 4294967295 / 86400 + 1
+ timeout 49711d sleep 0
+ test 124 = 0
+ fail=1
+ timeout 999999999999999999999999999999999999999999999999999999999999d 
sleep 0
+ test 124 = 0
+ fail=1
+ timeout 2.34e+5d sleep 0
+ test 124 = 0
+ fail=1
+ timeout 2.34 sleep 0
+ test 0 = 0
+ timeout .999999999 sleep 0
+ timeout --signal=invalid 1 sleep 0
timeout: invalid: invalid signal
Try 'timeout --help' for more information.

On Solaris 10 Update 11 as root, attached as 
"test-suite.log-monotonic-root-s10u11" shows a more promising result but 
still failure:

+++ date +%s
++ expr 2147483647 - 1437187249 + 100
+ KERNEL_OVERFLOW_LIMIT=710296498
+ timeout 710296498 sleep 0
+ test 0 '!=' 124
+ timeout 4294967296 sleep 0
+ test 124 = 0
+ fail=1
++ expr 4294967295 / 86400 + 1
+ timeout 49711d sleep 0
+ test 124 = 0
+ fail=1
+ timeout 999999999999999999999999999999999999999999999999999999999999d 
sleep 0
+ test 124 = 0
+ fail=1
+ timeout 2.34e+5d sleep 0
+ test 124 = 0
+ fail=1
+ timeout 2.34 sleep 0
+ test 0 = 0
+ timeout .999999999 sleep 0
+ timeout --signal=invalid 1 sleep 0
timeout: invalid: invalid signal
Try 'timeout --help' for more information.
+ test 125 = 125

The requirement for "root" privileges to use MONOTONIC is a non-starter 
in my books as the utility can not lower privileges for the command it 
runs - I hope you would agree. It seems that the tests fail even with 
the CLOCK_MONOTONIC option.

The following test run in the monotonic change builds on S10U8 and 
S10U11, as root for only a minute or so seem to be a repetition of 
previously seen results, on both systems:

  # while true; do time ./src/timeout 0.1 ./src/sleep inf; test $? != 
124 && break; done
./src/timeout 0.1 ./src/sleep inf  0.00s user 0.00s system 0% cpu 0.105 
total
./src/timeout 0.1 ./src/sleep inf  0.00s user 0.00s system 0% cpu 0.107 
total

But the same code (monotonic build tree) as a non-privileged user, gives 
approximately a one second result from "time" in addition to the error 
message.

% while true; do time ./src/timeout 0.1 ./src/sleep inf; test $? != 124 
&& break; done
./src/timeout: warning: timer_create: Not owner
./src/timeout 0.1 ./src/sleep inf  0.00s user 0.00s system 0% cpu 0.996 
total
./src/timeout: warning: timer_create: Not owner
./src/timeout 0.1 ./src/sleep inf  0.00s user 0.00s system 0% cpu 1.000 
total
./src/timeout: warning: timer_create: Not owner
./src/timeout 0.1 ./src/sleep inf  0.00s user 0.00s system 0% cpu 1.000 
total
./src/timeout: warning: timer_create: Not owner
./src/timeout 0.1 ./src/sleep inf  0.00s user 0.00s system 0% cpu 0.999 
total
./src/timeout: warning: timer_create: Not owner
./src/timeout 0.1 ./src/sleep inf  0.00s user 0.00s system 0% cpu 1.000 
total
./src/timeout: warning: timer_create: Not owner
./src/timeout 0.1 ./src/sleep inf  0.00s user 0.00s system 0% cpu 1.000 
total
./src/timeout: warning: timer_create: Not owner
./src/timeout 0.1 ./src/sleep inf  0.00s user 0.00s system 0% cpu 1.000 
total
./src/timeout: warning: timer_create: Not owner
./src/timeout 0.1 ./src/sleep inf  0.00s user 0.00s system 0% cpu 1.000 
total
./src/timeout: warning: timer_create: Not owner
./src/timeout 0.1 ./src/sleep inf  0.00s user 0.00s system 0% cpu 1.000 
total
./src/timeout: warning: timer_create: Not owner
./src/timeout 0.1 ./src/sleep inf  0.00s user 0.00s system 0% cpu 1.000 
total
./src/timeout: warning: timer_create: Not owner
./src/timeout 0.1 ./src/sleep inf  0.00s user 0.00s system 0% cpu 0.999 
total
./src/timeout: warning: timer_create: Not owner
^C
./src/timeout 0.1 ./src/sleep inf  0.00s user 0.00s system 0% cpu 0.971 
total

I hope I am provided the requested / required information this time :-)

Regards,
Peter

PS: The tmpfs bug (21062) affects commands as simple as "./src/cp -a 
tests .." (a command I issued before running the "gmake check" as root 
on S10U11)