AIX

AIX

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


#Power
 View Only
Expand all | Collapse all

AIX: read() on a psinfo file on /proc/

  • 1.  AIX: read() on a psinfo file on /proc/

    Posted Thu October 05, 2006 06:46 PM

    Originally posted by: SystemAdmin


    We have a C++ program trying to read the contents of psinfo files from ALL the directories in the following dir: /proc
    As you might already know, this dir is used by kernel to maintain info about ALL the processes running on the machine.
    Most of the time, read() on any of the psinfo files under /proc/<pid> works just fine.
    But sometimes it blocks for a really long time like in 10s of minutes (I think it blocks forever).

    When it blocks, if we try to do lsof on the file, the following is the output
    1. lsof /proc/21156016/psinfo
    lsof: WARNING -- child process 21012506 may be hung.
    lsof: status error on /proc/21156016/psinfo: Connection timed out

    Looked at the available documentation online and nothing in the documentation suggests that read() on psinfo file should block for a long time.
    If the kernel is writing the file, read() may block temporarily. (I am speculating on that documentation doesnt say it)

    Could you please throw some light on this issue? Appreciate your help.
    We noticed this behavior only on Multi-processor box. Tests on single processor AIX box didnt have such a problem. Just wanted to point that out, if the box being Multi-Processor box has anything to do with the problem.
    #AIX-Forum


  • 2.  Latest ML? - if yes then report this bug.

    Posted Tue October 10, 2006 09:01 AM

    Originally posted by: nagger


    Assuming your code is perfect and handles the case, for example, that processes end during reading the /proc files etc. then I think this is a bug as you can't work around a read() call hanging and so need reporting.

    I also assume you have the latest maintenace level for your AIX release - if you don't this may have already been fixed.
    #AIX-Forum