Bug 53070

Summary: daemon() in /etc/rc.d/init.d/functions fails to detect already-running daemon instances
Product: [Retired] Red Hat Linux Reporter: Need Real Name <jnikolic>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-09-03 06:03:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Need Real Name 2001-09-03 06:03:25 UTC
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-04 00:20:58 UTC
This is fixed in the roswell initscripts.