Bug 53070 - daemon() in /etc/rc.d/init.d/functions fails to detect already-running daemon instances
daemon() in /etc/rc.d/init.d/functions fails to detect already-running daemon...
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-09-03 02:03 EDT by Need Real Name
Modified: 2014-03-16 22:23 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-09-03 02:03:29 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 Need Real Name 2001-09-03 02:03:25 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

Description of problem:
The daemon() function within /etc/rc.d/init.d/functions attempts to 
discern whether or not any instances of the specifed process are already 
running.  If so then it returns without further invocations.  The snippet 
currently looks like:

  #See if it's already running.  Look *only* at the pid file.
  pidlist=`pidfileofproc $base`
[ -n "$pid" ] && return

This snippet is erroneous in that it tests whether or not the length of 
$pid is non-zero, yet it is $pidlist that is populated with existing pid
(s).  Result is that running instances are never detected.

Solution is to use consistent variable naming.

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


How reproducible:
Always

Steps to Reproduce:
1. Write a start-script that utilizes the daemon() function 
within /etc/rc.d/init.d/functions to start up a process.
2. Run the start-script, and note the # of running instances of the 
specified process.
3. Run the start-script a second time, and note that 2 processes should 
now be running.
	

Actual Results:  Two instances of the process were observed to be running 
after the second invocation of the start-script.

Expected Results:  Only one instance of the process was expected to be 
running after the second invocation of the start-script.

Additional info:

When I used consistent variable-naming (i.e. I changed $pid to $pidlist in 
the snippet from daemon() within /etc/rc.d/init.d/functions, the expected 
results were then produced.
Comment 1 Bill Nottingham 2001-09-03 20:20:58 EDT
This is fixed in the roswell initscripts.

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