From owner-freebsd-bugs@freebsd.org Mon Sep 19 17:11:00 2016 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F865BE1092 for ; Mon, 19 Sep 2016 17:11:00 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 565FAF27 for ; Mon, 19 Sep 2016 17:11:00 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u8JHB0aY022402 for ; Mon, 19 Sep 2016 17:11:00 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 212829] daemon(8) using -P swallows signals such as SIGHUP instead of propagating them Date: Mon, 19 Sep 2016 17:11:00 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 10.3-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: dch@skunkwerks.at X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2016 17:11:00 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D212829 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: dch@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=3D"/usr/sbin/daemon" command_args=3D"-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 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 dch: thought it already did.. I might have a kludge that u= ses child_pidfile somewhat handy. 01:56 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 AFAICT the SIGHUP is only sent by service(8) to daemon, and dae= mon doesn't propagate it further, when using `command_args=3D"-f -c -r -P ${pid= file} =E2=80=A6 ` 01:59 I think I swapped from -p to -P because using -p causes servic= e(8) to stop/start the child pid, and the daemon process restarts it behind your back. 02:30 But yes, should depend on -p.. may need an -s flag to pass signal to -p ? --=20 You are receiving this mail because: You are the assignee for the bug.=