Skip to contentSkip to conversation

tests: allow non-inotify tailf to keep up

PATCH In review Andreas Henriksson 3 participants 5 messages Jul 26, 2014 – Jul 29, 2014 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: allow non-inotify tailf to keep up

When tailf is not using inotify, it seems to sleep for 0.25s between checks. Just giving a 0.1s time window between update and removal of the input file thus gives little chance for tailf to succeed. Similar between startup and append to file, make sure initial content is read before appending additional data by bumping the time.

This should possibly be bumped much larger to make sure that the tailf process actually gets a chance to run at all in the given time window. Otherwise it might fail on really slow/overloaded machines.
The drawback would then ofcourse be to increase the time it takes to run the testsuite.

---
 tests/ts/tailf/simple | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/ts/tailf/simple +2 -2
index 955844d..d0a1c5c 100755
@@ -27,9 +27,9 @@ echo {a..z} > $INPUT
 
 $TS_CMD_TAILF $INPUT > $TS_OUTPUT 2>&1 &
 
-sleep 0.1
+sleep 0.5
 echo {0..9} >> $INPUT
-sleep 0.1
+sleep 0.5
 
 rm -f $INPUT
 
Signature · 1 line
2.0.1
#1 lore raw
Quoted 23 lines · Andreas Henriksson

When tailf is not using inotify, it seems to sleep for 0.25s between checks. Just giving a 0.1s time window between update and removal of the input file thus gives little chance for tailf to succeed. Similar between startup and append to file, make sure initial content is read before appending additional data by bumping the time.

This should possibly be bumped much larger to make sure that the tailf process actually gets a chance to run at all in the given time window. Otherwise it might fail on really slow/overloaded machines.
The drawback would then ofcourse be to increase the time it takes to run the testsuite.

---
 tests/ts/tailf/simple | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/ts/tailf/simple +0 -0
index 955844d..d0a1c5c 100755

tests/ts/tailf/simple echo {a..z} > $INPUT · line 34

Quoted 10 lines
tests/ts/tailf/simple +2 -2
@@ -27,9 +27,9 @@ echo {a..z} > $INPUT
 
 $TS_CMD_TAILF $INPUT > $TS_OUTPUT 2>&1 &
 
-sleep 0.1
+sleep 0.5
 echo {0..9} >> $INPUT
-sleep 0.1
+sleep 0.5
 
 rm -f $INPUT

For such tests coreutils uses a helper function
to apply a truncated exponential backoff,
to run quickly in the common case, but also
delay longer if necessary. See retry_delay_() at:

http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob;f=init.cfg;h=725ee121;hb=HEAD#l608

cheers,
Pádraig.

maintainer
#2 lore raw
Quoted 33 lines · Pádraig Brady
Quoted 32 lines · Andreas Henriksson

When tailf is not using inotify, it seems to sleep for 0.25s between checks. Just giving a 0.1s time window between update and removal of the input file thus gives little chance for tailf to succeed. Similar between startup and append to file, make sure initial content is read before appending additional data by bumping the time.

This should possibly be bumped much larger to make sure that the tailf process actually gets a chance to run at all in the given time window. Otherwise it might fail on really slow/overloaded machines.
The drawback would then ofcourse be to increase the time it takes to run the testsuite.

---
 tests/ts/tailf/simple | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/ts/tailf/simple +2 -2
index 955844d..d0a1c5c 100755
@@ -27,9 +27,9 @@ echo {a..z} > $INPUT
 
 $TS_CMD_TAILF $INPUT > $TS_OUTPUT 2>&1 &
 
-sleep 0.1
+sleep 0.5
 echo {0..9} >> $INPUT
-sleep 0.1
+sleep 0.5
 
Quoted 8 lines

tests/ts/tailf/simple echo {a..z} > $INPUT · line 34

Quoted 1 line
tests/ts/tailf/simple +0 -0
 rm -f $INPUT

For such tests coreutils uses a helper function
to apply a truncated exponential backoff,
to run quickly in the common case, but also
delay longer if necessary. See retry_delay_() at:

http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob;f=init.cfg;h=725ee121;hb=HEAD#l608

Andreas? (hint: send a new patch :-))

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#3 lore raw

Hello!

Quoted 5 lines · Karel Zak
Quoted 4 lines · Pádraig Brady

For such tests coreutils uses a helper function
to apply a truncated exponential backoff,
to run quickly in the common case, but also
delay longer if necessary. See retry_delay_() at:

Thanks for the pointer!

Quoted 4 lines
Quoted 2 lines

http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob;f=init.cfg;h=725ee121;hb=HEAD#l608

Andreas? (hint: send a new patch :-))

I fail to see how this is useful here. We either need a short delay (using inotify) or a longer delay (not using inotify). All other steps seems pointless to me, even harmful in non-inotify case!

Having a too short delay before appending data could make the testcase succed even when tailf doesn't work properly (because it wakes up and reads all data in first go).
And obviously having a too short delay before the file removal could cause the test case to fail, but I consider false-positives worse then false-negatives myself.

My hope was that 2*0.5s delay would be both low and high enough to be good enough everywhere. Just wanted to warn about this maybe not being 100% fail-proof.

If anyone else want to propose a solution/patch here, feel free!

Regards,
Andreas Henriksson

maintainer
#4 lore raw
Quoted 12 lines · Andreas Henriksson

Hello!

Quoted 5 lines · Karel Zak
Quoted 4 lines · Pádraig Brady

For such tests coreutils uses a helper function
to apply a truncated exponential backoff,
to run quickly in the common case, but also
delay longer if necessary. See retry_delay_() at:

Thanks for the pointer!

Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob;f=init.cfg;h=725ee121;hb=HEAD#l608

Andreas? (hint: send a new patch :-))

I fail to see how this is useful here. We either need a short delay (using inotify) or a longer delay (not using inotify). All other steps seems pointless to me, even harmful in non-inotify case!

OK, merged. Maybe someone will provide a better solution later.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com