Bug 10112 - Usage of "ps" is too expensive
Summary: Usage of "ps" is too expensive
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: initscripts
Version: 1.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-03-10 15:06 UTC by Enrico Scholz
Modified: 2014-03-17 02:12 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2000-03-20 16:32:49 UTC
Embargoed:


Attachments (Terms of Use)

Description Enrico Scholz 2000-03-10 15:06:03 UTC
I am running a NIS server (ypserv) being used as client (ypbind) also. At
shutdown I recognize a lockup (until a timeout occurs) of all services
going to killed after ypserv (e.g. portmap).

Tracing back led to the execution of "ps -h" in
/etc/rc.d/init.d/functions::killproc(). "ps" doesn't take care for any
option and tries to make a lookup for the user/group-name of each running
process. But because the NIS server is shut down already, nobody listens
for it and the lookup will hang.

Best solution would be IMHO the modification of "ps" so it's doing a
minimal work only. For the meantime I suggest a substitution of "ps h" by
"lookForPid" being defined as:

------
lookForPid() {
    while [ "$1" ]; do
       [ -d /proc/$1 ] && return 0
       shift
    done

    return 1
}
------

Perhaps a substitution by "pidof $base" is possible also.

Comment 1 Bill Nottingham 2000-03-20 16:32:59 UTC
Should be changed as of 5.02-1.


Note You need to log in before you can comment on or make changes to this bug.