RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 675299 - 'tail -f' waits forever for inotify
Summary: 'tail -f' waits forever for inotify
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: kernel
Version: 6.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Eric Paris
QA Contact: Red Hat Kernel QE team
URL:
Whiteboard:
Depends On:
Blocks: 6.1KnownIssues
TreeView+ depends on / blocked
 
Reported: 2011-02-04 20:10 UTC by Eduardo Habkost
Modified: 2013-01-09 23:32 UTC (History)
3 users (show)

Fixed In Version: 675299
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-19 12:43:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
strace of script under 2.6.32-112.el6.x86_64 (33.25 KB, text/plain)
2011-02-04 20:19 UTC, Eduardo Habkost
no flags Details
strace of script under 2.6.32-108.el6.x86_64 (working) (33.58 KB, text/plain)
2011-02-04 20:22 UTC, Eduardo Habkost
no flags Details
strace of script under 2.6.32-109.el6.x86_64 (broken) (33.92 KB, text/plain)
2011-02-04 20:33 UTC, Eduardo Habkost
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0542 0 normal SHIPPED_LIVE Important: Red Hat Enterprise Linux 6.1 kernel security, bug fix and enhancement update 2011-05-19 11:58:07 UTC

Description Eduardo Habkost 2011-02-04 20:10:47 UTC
Description of problem:
when running 'tail -f' on some scenarios, it is failing to show new contents on files.

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

2.6.32-112.el6.x86_64

How reproducible:
Always.



Steps to Reproduce:
Run the following script:
----------------
#!/bin/bash
f=/tmp/tail-test
echo file: $f
echo ok > "$f"
sleep 1
tail -f "$f" &
sleep 1
echo ok2 > "$f"
wait
------------------


Actual results:
tail shows "ok"


Expected results:
tail shows "ok" and "ok2" lines.


Additional info:
strace output:


[pid 30838] inotify_init()              = 4
[pid 30838] inotify_add_watch(4, "/tmp/tail-test", IN_MODIFY|IN_ATTRIB|IN_DELETE_SELF|IN_MOVE_SELF) = 1
[pid 30838] fstat(3, {st_mode=S_IFREG|0644, st_size=3, ...}) = 0
[pid 30838] read(4,  <unfinished ...>
[pid 30839] <... nanosleep resumed> NULL) = 0
[pid 30839] close(1)                    = 0
[pid 30839] close(2)                    = 0
[pid 30839] exit_group(0)               = ?
Process 30835 resumed
Process 30839 detached
[pid 30835] <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 30839
[pid 30835] rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
[pid 30835] --- SIGCHLD (Child exited) @ 0 (0) ---
[pid 30835] wait4(-1, 0x7fff9ffbc25c, WNOHANG, NULL) = 0
[pid 30835] rt_sigreturn(0xffffffffffffffff) = 0
[pid 30835] rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x3bb2e32a20}, {0x43d220, [], SA_RESTORER, 0x3bb2e32a20}, 8) = 0
[pid 30835] rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
[pid 30835] read(255, "echo ok2 > \"$f\"\nwait\n", 110) = 21
[pid 30835] write(2, "+ echo ok2\n", 11+ echo ok2
) = 11
[pid 30835] open("/tmp/tail-test", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
[pid 30835] fcntl(1, F_GETFD)           = 0
[pid 30835] fcntl(1, F_DUPFD, 10)       = 10
[pid 30835] fcntl(1, F_GETFD)           = 0
[pid 30835] fcntl(10, F_SETFD, FD_CLOEXEC) = 0
[pid 30835] dup2(3, 1)                  = 1
[pid 30835] close(3)                    = 0
[pid 30835] write(1, "ok2\n", 4)        = 4
[pid 30835] dup2(10, 1)                 = 1
[pid 30835] fcntl(10, F_GETFD)          = 0x1 (flags FD_CLOEXEC)
[pid 30835] close(10)                   = 0
[pid 30835] rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
[pid 30835] write(2, "+ wait\n", 7+ wait

Comment 1 Eduardo Habkost 2011-02-04 20:16:02 UTC
oops, my sample script is wrong (it was supposed to use ">""). I'll send a better one in a few moments.

Comment 2 Eduardo Habkost 2011-02-04 20:19:50 UTC
Created attachment 477106 [details]
strace of script under 2.6.32-112.el6.x86_64

Updated script:
------------------
#!/bin/bash
f=/tmp/tail-test
echo file: $f
echo ok > "$f"
sleep 1
tail -f "$f" &
sleep 1
echo ok2 >> "$f"
wait
----------------

Updated strace output attached.

Comment 3 Eduardo Habkost 2011-02-04 20:22:38 UTC
Created attachment 477108 [details]
strace of script under 2.6.32-108.el6.x86_64 (working)

2.6.32-108.el6.x86_64 seems to be working. strace attached.

Comment 4 Eduardo Habkost 2011-02-04 20:33:13 UTC
Created attachment 477113 [details]
strace of script under 2.6.32-109.el6.x86_64 (broken)

Reproduced under 2.6.32-109.el6.x86_64.

Comment 5 Dor Laor 2011-02-09 11:52:08 UTC
This kernel bug breaks kvm autotest which is our main QA tool. It's a blocker from our POV.

Comment 6 Eric Paris 2011-02-09 18:50:13 UTC
This was caused by my broken fix for BZ 582109.  I have requested that the patch applied be reverted.  I'm going to put this bug into the 'POST' state as a request to fix has been posted to the internal list.

Comment 9 RHEL Program Management 2011-02-21 20:20:21 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux maintenance release. Product Management has 
requested further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed 
products. This request is not yet committed for inclusion in an Update release.

Comment 11 Mike Gahagan 2011-02-22 16:13:33 UTC
reproduced on -115, confirmed it's fixed on -117.

Comment 12 errata-xmlrpc 2011-05-19 12:43:11 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0542.html


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