https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212829

            Bug ID: 212829
           Summary: daemon(8) using -P swallows signals such as SIGHUP
                    instead of propagating them
           Product: Base System
           Version: 10.3-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: d...@skunkwerks.at

When a service such as net-mgmt/riemann (java/clojure) is run under daemon(8),
`service reload` sends the SIGHUP to the parent daemon(8) process instead of
the managed child process.

command="/usr/sbin/daemon"
command_args="-f -c -r -P ${pidfile} \
    ${riemann_java_home}/bin/java \
    ${riemann_java_opts} ...

If the -p flag is used instead, which would provide the child's PID, then
`service restart` restarts the child, and not the parent daemon(8) process,
which then tries to restart *another* child. messy.

I can't see a way around this other than either not using daemon(8), or
alternatively teaching daemon(8) in -P mode to propagate SIGHUP to the child
process.


# notes from irc

21:20 <dch> is it possible for daemon(8) to pass on the SIGHUP it receives via
`service $name reload` to the child? it feels like this should be possible
somehow
21:24 <@cem> It would be possible
23:06 <RootWyrm> dch: thought it already did.. I might have a kludge that uses
child_pidfile somewhat handy.
01:56 <dch> RootWyrm: I thought it did too, I looked at
/usr.sbin/daemon/daemon.c and realise I am out of my depth here.
01:58 <dch> AFAICT the SIGHUP is only sent by service(8) to daemon, and daemon
doesn't propagate it further, when using `command_args="-f -c -r -P ${pidfile}
… `
01:59 <dch> I think I swapped from -p  to -P because using -p causes service(8)
to stop/start the child pid, and the daemon process restarts it behind your
back.
02:30 <RootWyrm> But yes, should depend on -p.. may need an -s flag to pass
signal to -p ?

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to