Bug 240053 - 'tail -f' not responding ias snappy as technical possible
'tail -f' not responding ias snappy as technical possible
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
6
All Linux
medium Severity low
: ---
: ---
Assigned To: Tim Waugh
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-05-14 13:51 EDT by Folkert van Heusden
Modified: 2007-11-30 17:12 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-05-15 10:28:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Folkert van Heusden 2007-05-14 13:51:08 EDT
Description of problem:
I noticed that tail does not react as snappy to changes in a file it
monitors (using 'tail -f') as is technically possible. So I did an
strace on it and found the following
fstat(3, {st_mode=S_IFREG|0644, st_size=3559, ...}) = 0
nanosleep({1, 0}, NULL)                 = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=3559, ...}) = 0
nanosleep({1, 0}, NULL)                 = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=3559, ...}) = 0
nanosleep({1, 0}, NULL)                 = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=3559, ...}) = 0
nanosleep({1, 0}, NULL)                 = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=3559, ...}) = 0
nanosleep({1, 0}, NULL)                 = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=3559, ...}) = 0
nanosleep({1, 0}, NULL)                 = 0
...
as you can see it sleeps for a second between each check. Causing a
delay of maximum 1 second before a change in the file monitored is
reflected in the output of tail. Furthermore: it is not efficient to use
fstat to see what has changed to the file. I propose a change to tail
that either uses directly the inotify kernel-interface or via de sgi
FAM-daemon. I once already implemented this using the older dnotify
interface.

Version-Release number of selected component (if applicable):
ALL

How reproducible:
tail -f file
to see what I mean:
strace tail -f file

Steps to Reproduce:
1. tail -f file
2.
3.
  
Actual results:
fstat(3, {st_mode=S_IFREG|0644, st_size=3559, ...}) = 0
nanosleep({1, 0}, NULL)                 = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=3559, ...}) = 0
nanosleep({1, 0}, NULL)                 = 0
...

Expected results:
a call to inotify or the SGI FAM daemon or so

Additional info:
'turbotail' is more or less a drop-in replacement using the obsoleted dnotify
interface but contains bugs ( http://www.vanheusden.com/turbotail/ ).
Comment 1 Tim Waugh 2007-05-15 10:28:36 EDT
I think this is something to try to get upstream first of all.  It's a good idea
in theory, but I'm not sure it's something we want to spend much effort on. 
It's a fairly low benefit<->effort trade-off..

Note You need to log in before you can comment on or make changes to this bug.