From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031009 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): procps-2.0.17-1 How reproducible: Sometimes Steps to Reproduce: Run "vmstat 3". Actual Results: vmstat dies eventually. The timing is erratic but pretty much reproducible every time. Additional info:
Can you reproduce this with procps 3.1.15?
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 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xbf512000 _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) = ?
For RHEL3 fixed in procps-2.0.17-13.1.
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. http://rhn.redhat.com/errata/RHBA-2005-156.html