AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
  • 1.  /proc filing system - strange behaviour

    Posted Fri September 28, 2007 03:31 AM

    Originally posted by: ThosRTanner


    it seems as though there is something busted in the implementation of /proc - the number of entries it has can very wildly over a short period of time:

    A reasonably typical session goes something like this

    > ls /proc | wc -l
    653
    > ls /proc | wc -l
    420
    > ls /proc | wc -l
    652

    ps -ef gives a completely different result, but as least it is consistent (but not very easy to read the output). It causes absolute havoc with some of our scripts.

    We have not killed and created 200 processes over the time it takes to do 3 ls's

    Are there any known issues about this / suggested workrounds / known patches?

    Thanks
    #AIX-Forum


  • 2.  Re: /proc filing system - strange behaviour

    Posted Fri September 28, 2007 07:17 AM

    Originally posted by: SystemAdmin


    My curiosity is getting the better of me here. Why do you see this as a problem? What scripts do you have that depend on the number of subdirectories in /proc? I've been happily supporting many AIX systems for years without ever knowing or caring what was in /proc.

    FWIW

    Jim Lane
    #AIX-Forum


  • 3.  Re: /proc filing system - strange behaviour

    Posted Fri September 28, 2007 07:32 AM

    Originally posted by: ThosRTanner


    > My curiosity is getting the better of me here. Why do
    > you see this as a problem? What scripts do you have
    > that depend on the number of subdirectories in /proc?
    > I've been happily supporting many AIX systems for
    > years without ever knowing or caring what was in
    > /proc.
    >
    Because I want to use /proc to get information about what processes are running in a more-or-less platform independent way. The system 5 compliant version of ps supplied by ibm is hopelessly broken. Interpreting the output from ps is also pretty horrendous, and the information we need can be gleaned from the psinfo file with a little bit of effort. Certainly the perl module we have which looks at /proc is a whole lot cleaner (even with a raft of comments) than the version which used ps (and it's faster).

    Well it would have been cleaner and faster, apart from the issues noted above.

    Is it too much to hope for that if I get a list of all the directories in /proc, it'll at least include entries for all the pids that existed both before the start of the request and after the end. On other systems, that seems to be a reasonable assumption. On AIX - no. Furthermore, AIX will arbitrarily decide from time to time that it can't find /proc/<pid>/psinfo for a process that is actually running

    I don't need to know how many subdirectories are there. But if a process has been running for 2 days, I'd like to see an entry for it in /proc. And I don't always, for no very good reason.
    #AIX-Forum


  • 4.  Re: /proc filing system - strange behaviour

    Posted Tue October 02, 2007 07:16 AM

    Originally posted by: SystemAdmin


    What is it about the IBM version of ps that's "broken"? I've been using it for years without ever noticing any problems. Then again none of my systems have ever seemed to exhibit the problems you're seeing with /proc.
    FWIW interpreting the output of ps using Perl seems anything but horrendous to me. This is columnar text data, just the sort of thing Perl was invented for.

    Regards,
    Jim Lane
    #AIX-Forum


  • 5.  Re: /proc filing system - strange behaviour

    Posted Tue October 02, 2007 07:22 AM

    Originally posted by: ThosRTanner


    > What is it about the IBM version of ps that's
    > "broken"? I've been using it for years without ever
    > noticing any problems. Then again none of my systems
    > have ever seemed to exhibit the problems you're
    > seeing with /proc.\
    The system v version (/usr/sysv/bin/ps). It will loose the 2nd half of one line and the first half of the next line, completely at random. The reason for using this particular version of ps is that the output is somewhat closer to other systems versions of ps.

    > FWIW interpreting the output of ps using Perl seems
    > anything but horrendous to me. This is columnar text
    > data, just the sort of thing Perl was invented for.
    Umm, yes, but trying to get consistent information over 2 or more systems where the output from ps has subtly different column widths and orders (and even decisions about line breaks) on each system. perl is very good at it but it's still a nightmare.

    Cheers

    Tom
    #AIX-Forum


  • 6.  Re: /proc filing system - strange behaviour

    Posted Fri September 28, 2007 07:43 AM

    Originally posted by: ThosRTanner


    I've just found a post in comp.unix.aix from 2004 indiciating this was a problem then, and the user submitted a ticket to IBM:

    Date: 17 Feb 2004 11:22:37 -0800

    <quote>
    We are running on AIX 5.1.0.0 ML4.

    We have the need to obtain highly accurate CPU usage information about
    all the processes in a tree with a given root pid. We are doing an
    opendir() of /proc, reading all entries (pids), and opening
    /proc/<pid>/psinfo to obtain the psinfo.pr_time for each one. However,
    in the process of testing, we found that the process ids of running
    processes would inexplicably disappear from /proc, meaning they would
    not show up in opendir/readdir, or for that matter, an ls of /proc. They
    would however be visible on reading /proc/<pid> directly. What the
    heck is going on here?! It is critical for us to have /proc accurately
    reflect the currently running processes. I've submitted an ETR to IBM,
    but was curious to know whethere anyone else has seen this problem.
    </quote>

    Obviously IBM have taken this issue very seriously, I don't think
    #AIX-Forum


  • 7.  Re: /proc filing system - strange behaviour

    Posted Fri September 28, 2007 08:33 AM

    Originally posted by: MarkTaylor


    The fixes would wholly depend on what level of AIX you are running .. if 5.3 the you may want to check you have these installed IY61842, IY89339, IY92959

    Rgds
    Mark Taylor
    #AIX-Forum


  • 8.  Re: /proc filing system - strange behaviour

    Posted Fri September 28, 2007 08:51 AM

    Originally posted by: ThosRTanner


    > The fixes would wholly depend on what level of AIX
    > you are running .. if 5.3 the you may want to check
    > you have these installed IY61842, IY89339, IY92959
    >
    > Rgds
    > Mark Taylor

    Thanks. I'll get that checked.
    #AIX-Forum