Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Dec 2022 22:08:30 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 268580] [PATCH] Add shutdown delay to daemon(8)
Message-ID:  <bug-268580-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268580

            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=3D239046&action=
=3Dedit
Diff to add shutdown_delay to daemon utility

Currently if daemon is supervising a process and it receives SIGTERM it sen=
ds
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 l=
og
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 proce=
ss
it can get removed before the supervised process actually exits. This can c=
ause
issues with processes that expect the PID file to be there while the previo=
usly
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 t=
he
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 aro=
und
indefinitely if the supervised process is wedged somewhere deep in the kern=
el
with signals blocked, but this way it will properly keep the PID file around
while the supervised process is running.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-268580-227>