Bug 46387

Summary: initlog causes some daemons to die with SIGPIPE
Product: [Retired] Red Hat Linux Reporter: peter.benie
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED WONTFIX QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-02-15 20:55:45 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 peter.benie 2001-06-28 09:27:40 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.75 [en] (X11; U; Linux)

Description of problem:
initlog -c <cmd> (used by daemon() in init.d/functions) runs the specified
command as a child. initlog's event loop waits for the following
conditions:
 - data from the command's stdout
 - data from the command's stderr
 - SIGCHLD

initlog dies when it receives SIGCHLD.

If the command daemonizes (ie. it fork()s and the parent dies), and then
produces output on stdout or stderr, it gets an error back (either SIGPIPE
or EPIPE, depending on context). Programs that don't ignore SIPIPE and
programs that actually check output streams for errors will die.


How reproducible:
Always

Steps to Reproduce:
pxe-0.1-22 (from RH7.1, rebuilt for RH6.2) demonstrates this problem.
I

Actual Results:  It starts happily enough, and dies after it has been used
for a while.


Additional info:

Comment 1 Bill Nottingham 2001-06-28 19:52:03 UTC
Why is it trying to write to stdout/stderr after it's backgrounded itself?
It sounds like the daemon is broken.

Comment 2 peter.benie 2001-06-29 09:59:36 UTC
I'm half in agreement with you, and if you want to reassign this bug to the pxe
package then go ahead.

However, I doubt that pxe is unique in that it uses output streams after
daemonizing. The only other example that I can think of right now is xdm (which
RH doesn't start via initlog, thus avoiding this problem), but I would be amazed
if there weren't others too. 

The reason I'm not completely convinced that initlog is right to exit is that
some libraries (including libc) occasionally write diagnostic output to stderr.
This output being is the program's control. On most systems, you end up with
output on the console (fairly harmless). With RH, the daemon dies unexpectedly.
A common workaround is for daemons to redirect stdout and stderr to /dev/null,
but delibrately throwing away diagnostic output is rather unhelpful.


Comment 3 Bill Nottingham 2005-02-15 20:55:45 UTC
Closing out bugs on older, no longer supported, releases.

initlog is no longer in the current devel tree, so it is unlikely to change.