[Bug 268580] [PATCH] Add shutdown delay to daemon(8)
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 268580] Add shutdown delay to daemon(8)"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 268580] Add shutdown delay to daemon(8)"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 268580] Add shutdown delay to daemon(8)"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 268580] Add shutdown delay to daemon(8)"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 268580] Add shutdown delay to daemon(8)"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 268580] Add shutdown delay to daemon(8)"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 268580] Add shutdown delay to daemon(8)"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 268580] Add shutdown delay to daemon(8)"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 Dec 2022 22:08:30 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268580
Bug ID: 268580
Summary: [PATCH] Add shutdown delay to daemon(8)
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: bin
Assignee: bugs@FreeBSD.org
Reporter: nhuff@acm.org
Created attachment 239046
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=239046&action=edit
Diff to add shutdown_delay to daemon utility
Currently if daemon is supervising a process and it receives SIGTERM it sends
SIGTERM to the supervised process and then immediately exits. This has a
couple potential issues.
1. If the daemon process is writing the stdout/stderr of the process to a log
file or syslog it can miss messages that are generated after the supervised
process receives SIGTERM.
2. If the daemon process is maintaining a PID file for the supervised process
it can get removed before the supervised process actually exits. This can cause
issues with processes that expect the PID file to be there while the previously
supervised process is running.
This patch adds a -d <shutdown_delay> option to daemon. If daemon receives
SIGTERM it will send SIGTERM to the supervised process and then continue
collecting and outputting stdout/stderr. After shutdown_delay seconds if the
process hasn't already exited it will send SIGKILL to the process and then wait
for it to exit. This will potentially cause the daemon process to hang around
indefinitely if the supervised process is wedged somewhere deep in the kernel
with signals blocked, but this way it will properly keep the PID file around
while the supervised process is running.
--
You are receiving this mail because:
You are the assignee for the bug.