Bug 109147 - vmstat dies parsing /proc/stats
Summary: vmstat dies parsing /proc/stats
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: procps   
(Show other bugs)
Version: 3.0
Hardware: i686 Linux
Target Milestone: ---
Assignee: Karel Zak
QA Contact:
Depends On:
Blocks: 132991
TreeView+ depends on / blocked
Reported: 2003-11-04 23:52 UTC by Shantanu Goel
Modified: 2007-11-30 22:06 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-05-20 03:25:49 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2005:156 normal SHIPPED_LIVE procps bug fix update 2005-05-19 04:00:00 UTC

Description Shantanu Goel 2003-11-04 23:52:04 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1)

Description of problem:
Running "vmstat 3" eventually dies with the following error:

open: No such file or directory
error: failed to parse /proc/stats

I am running kernel-smp-2.4.22-1.2115.nptl on a Dell 1600SC with dual
Xeon CPUs.  I have encountered this error with earlier test kernels as
far back as 2088 as well.

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

How reproducible:

Steps to Reproduce:
Run "vmstat 3".

Actual Results:  vmstat dies eventually.  The timing is erratic but
pretty much reproducible every time.

Additional info:

Comment 1 Daniel Walsh 2004-02-11 13:56:27 UTC
Can you reproduce this with procps 3.1.15?

Comment 2 Brian Hirt 2004-07-27 18:28:58 UTC
this seems to be fixed in procps 3.x, but exists in procps 2.0.17 which is what core one 
uses.   I have the answer to this problem.:

I did a strace and looked at the code and i've found what i think is a problem.  there is a 
race condition in getrunners() if a program exits between the readdir(proc) and the open() 
vmstat will die.    if /proc/pid/stat is missing, I think it should be assumed that the 
process has died, and continue gracefully if the errno is file not found.  look at line 48 
vmstat.c in 2.0.17

strace reveals:

open("/proc/16928/stat", O_RDONLY)      = 5
read(5, "16928 (bash) S 16908 10483 4568 "..., 1023) = 209
close(5)                                = 0
open("/proc/16929/stat", O_RDONLY)      = -1 ENOENT (No such file or directory)
dup(2)                                  = 5
fcntl64(5, F_GETFL)                     = 0x2 (flags O_RDWR)
fstat64(5, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
_llseek(5, 0, 0xbff811b8, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
write(5, "open: No such file or directory\n", 32open: No such file or directory
) = 32
close(5)                                = 0
munmap(0xbf512000, 4096)                = 0
write(2, "error: failed to parse /proc/sta"..., 35error: failed to parse /proc/stats
) = 35
munmap(0xbf513000, 4096)                = 0
exit_group(1)                           = ?

Comment 5 Karel Zak 2004-11-23 18:05:21 UTC
For RHEL3 fixed in procps-2.0.17-13.1.

Comment 6 Dennis Gregorovic 2005-05-20 03:25:49 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 the 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.


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