Bug 440658 - rc.d/init.d/functions:status() should consider pid files before pidof
Summary: rc.d/init.d/functions:status() should consider pid files before pidof
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: initscripts
Version: 5.2
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: initscripts Maintenance Team
QA Contact: Brock Organ
URL:
Whiteboard:
: 463205 (view as bug list)
Depends On: 433018
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-04-04 12:58 UTC by David Howells
Modified: 2009-09-02 11:14 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-02 11:14:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2009:1344 0 normal SHIPPED_LIVE initscripts bug fix update 2009-09-01 10:44:36 UTC

Description David Howells 2008-04-04 12:58:24 UTC
+++ This bug was initially created as a clone of Bug #433018 +++

Description of problem:

The status() function from rc.d/init.d/functions uses pidof to locate pids
before considering pid files. A service that uses pid files will not have them
considered, except for the pid dead but pid file exists case, and pids of
processes with the same name as the service may be incorrectly associated with
the service.

This can result in issues during "service X start" when the init script for X 
is
written to be LSB-ish compliant (only start if not running) and it uses 
status()
to determine if the service is running.


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

At least version initscripts 8.60-1 and 8.63-1


Additional info:

A proposed solution is attached as a patch to initscripts-8.63. It changes the
logic of status() to consider pid files only if one is available. There is no
logical change for init scripts that do not use pid files, they will still use
pidof to locate pids of their processes. The logical change for scripts that 
use
pid files is that they cannot have similarly named processes inadvertently
associated with their service, a good thing. However, if the script uses pid
files and those pid files are improperly managed, i.e. don't hold correct pids
for the service or are not removed when the service stops, the script is
essentially relying on pidof and this change will expose the dependency and 
the
broken pid file management.

-- Additional comment from mfarrellee on 2008-02-15 13:14 EST --
Created an attachment (id=295025)
proposed patch to rc.d/init.d/functions


--------------
I'm seeing this bug with cachefilesd.  The initscript for that recurses into 
itself about three times for condrestart, and in the innermost process, pidof 
finds the PID of the outermost process when cachefilesd isn't running (noticed 
when fixing bug 237827).

Comment 1 Bill Nottingham 2008-09-24 14:15:35 UTC
*** Bug 463205 has been marked as a duplicate of this bug. ***

Comment 2 Bill Nottingham 2008-09-24 14:16:27 UTC
See bug 433018 for the upstream patch - something like that would probably be reasonable for RHEL 5.

Comment 4 Harald Hoyer 2009-05-05 12:51:31 UTC
Please test the erratum candidate:
http://people.redhat.com/harald/downloads/initscripts/initscripts-8.45.26.1.el5/

Comment 8 errata-xmlrpc 2009-09-02 11:14:19 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-1344.html


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