Bug 188406 - __pids_pidof() function sometimes fails to return pid
__pids_pidof() function sometimes fails to return pid
Status: CLOSED INSUFFICIENT_DATA
Product: Fedora
Classification: Fedora
Component: initscripts (Show other bugs)
5
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-04-09 02:27 EDT by Ian Laurie
Modified: 2014-03-16 22:59 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-09-18 15:29:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ian Laurie 2006-04-09 02:27:18 EDT
Description of problem:
__pids_pidof() function in /etc/rc.d/init.d/functions fails to return the
pid if the process has a different root directory.

Version-Release number of selected component (if applicable):
initscripts-8.31.1-1

How reproducible:
Always

Steps to Reproduce:
1.  Issue command "service thttpd start"
2.  Issue command "service thttpd status"
3.  Observe bogus message "thttpd dead but pid file exists"
  
Actual results:
The __pids_pidof() in /etc/rc.d/init.d/functions sometimes fails to return
the pid of a process.  Failures happen when the process has a different
root directory.  This will ALWAYS be true with some services, for example
thttpd, since it does a chroot() !!

Expected results:
The function __pids_pidof() should always work.

Additional info:
The function looks like this:

# Output PIDs of matching processes, found using pidof
__pids_pidof() {
	pidof -c -o $$ -o $PPID -o %PPID -x "$1" || \
		pidof -c -o $$ -o $PPID -o %PPID -x "${1##*/}"
}

The cause of the problem is the '-c' option which causes the pidof
command to only return process ids that are running with the same root
directory.

Is that **really** necessary?  Why was that explicitly done?  If you get
rid of the option (as per RHEL3 & 4) it will work always.
Comment 1 MASAO TAKAHASHI 2006-07-18 22:38:15 EDT
There is a same problem in initscripts-8.35-1.1
Comment 2 Miloslav Trmač 2006-07-29 14:04:49 EDT
> Why was that explicitly done?
To avoid incorrect matches with services running in chroot installations.  Rawhide
versions also check whether the PID specified in the PID file exists before
concluding the process is dead, not only (pidof) results.

> There is a same problem in initscripts-8.35-1.1
Can you recheck, please?  This is a duplicate of #182623, which was supposed
to be fixed in initscripts-8.32.  It seems to work correctly with
initscripts-8.36-1 and thttpd-2.25b-11.fc6.
Comment 3 Bill Nottingham 2007-09-18 15:29:13 EDT
Closing, no response.

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