Re: Cd to nonexistent directory in /proc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17Jun2011 20:12, Kevin Martin <kevintm@xxxxxxxxxxxxx> wrote:
| On 06/17/2011 07:16 PM, Patrick O'Callaghan wrote:
| > On Fri, 2011-06-17 at 15:03 -0700, Jonathan Ryshpan wrote:
| >> Investigating a hanging instance of googleearth (wich process number
| >> 3110), I noticed that it's possible to 
| >> 	cd /proc/3110
| >> while on the other hand
| >> 	ls /proc
| >> does not show 3110 as being in the proc directory.
| >>
| >> Any ideas what's going on?
| > I can't imagine how that could happen, unless the directory entry
| > disappeared between you doing the cd and the ls, perhaps because the
| > process terminated. OTOH is you can reproduce this reliably, it could
| > merit a Bugzilla report.
| >
| > poc
| >
| 
| It's a kernel / system call bug somewhere.  We ran (the company I work for) into this exact bug in our software application (a
| monitoring tool for monitoring system health, applications, doing log file scraping).  Monitoring of processes worked on AIX,
| Solaris, etc. but with a version of Linux starting about 3-4 years ago, it stopped working reliably.  It has to do with a system
| call and I can't remember at this time what it was.  I'll look back on our application fixes and see if I can come up with what the
| fix was.  It might absolutely merit a Bugzilla.

[speculation...]
It might be raciness in the readdir calls. I'd imagine /proc is rather
volatile becuase of all the PIDs. Readdir has always been a weak link in
the directory listing stuff (not just Linux, though it or GNU ls might
be particularly prone to exposing it).
[/speculation]

Because readdir is racy, my personal practice is to write code like
this:

  opendir(...)
  loop over readdir() as fast as possible, stashing names
  closedir()
  now stat() or whatever all the names as needed

stat() et al are not racy. We keep the raciness in the smallest
timeframe possible with the above approach.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

ASCII  n s. [from the greek]  Those people who, at certain times of the year,
have no shadow at noon; such are the inhabitatants of the torrid zone.
        - 1837 copy of Johnson's Dictionary
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux