On 17Jun2011 20:12, Kevin Martin <kevi...@ameritech.net> 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 <c...@zip.com.au> 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@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

Reply via email to