Bug 46387 - initlog causes some daemons to die with SIGPIPE
Summary: initlog causes some daemons to die with SIGPIPE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 6.2
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
Depends On:
TreeView+ depends on / blocked
Reported: 2001-06-28 09:27 UTC by peter.benie
Modified: 2014-03-17 02:21 UTC (History)
1 user (show)

Clone Of:
Last Closed: 2005-02-15 20:55:45 UTC

Attachments (Terms of Use)

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
 - data from the command's stdout
 - data from the command's stderr

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:

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

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.

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