[Bug 285742] usr.sbin/daemon refuses to shut down even after child is terminated

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 29 Mar 2025 12:46:12 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285742

            Bug ID: 285742
           Summary: usr.sbin/daemon refuses to shut down even after child
                    is terminated
           Product: Base System
           Version: 14.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: dch@freebsd.org

14.2-RELEASE jail
tested with both /usr/sbin/daemon from 14.2-RELEASE & 
also 14-STABLE as of 20250329 unpacked from tar and dropped on top.

from 14-STABLE SHA256 (/usr/sbin/daemon) =
899300a90660afbb0340110b8f2244499cb32b0d52791e61c41a79ffedbb52b2

rc script from https://reviews.freebsd.org/D49563 is supposed to start &
stop both the supervised child & the parent via `service anubis stop`.

I've tried all 4 combos:

-r -P -p 
-r -P
-r -p
-r

And in each case the daemon does not die. Stubborn daemon! In some
cases the child is correctly terminated, but as daemon is still running
its not possible to start the service without `pkill -9 -ilf daemon`
or similar.


Logs below


### -r only

root@proxy:/tmp # pkill -9 -ilf anubis; service anubis start; sleep 5; pgrep
-ilf anubis; service anubis stop; sleep 6; pgrep -ilf anubis
No matching processes belonging to you were found
Starting anubis.
27957 daemon: /usr/local/bin/anubis[28031]
28031 /usr/local/bin/anubis -target http://172.16.1.4:4000/ -bind :4000
anubis not running? (check /var/run/anubis.pid).
27957 daemon: /usr/local/bin/anubis[28031]
28031 /usr/local/bin/anubis -target http://172.16.1.4:4000/ -bind :4000
root@proxy:/tmp #

### -r -p -P

# pkill -9 -ilf anubis; service anubis start; sleep 5; pgrep -ilf anubis;
service anubis stop; sleep 6; pgrep -ilf anubis
kill -9 85190
kill -9 86604
Starting anubis.
90508 /usr/local/bin/anubis -target http://172.16.1.4:4000/ -bind :4000
90480 daemon: /usr/local/bin/anubis[90508]
Stopping anubis.
Waiting for PIDS: 90508.
91932 /usr/local/bin/anubis -target http://172.16.1.4:4000/ -bind :4000
90480 daemon: /usr/local/bin/anubis[91932]
root@proxy:/tmp #

### -r -p only

root@proxy:/tmp # pkill -9 -ilf anubis; service anubis start; sleep 5; pgrep
-ilf anubis; service anubis stop; sleep 6; pgrep -ilf anubis
kill -9 91932
kill -9 90480
Starting anubis.
18440 /usr/local/bin/anubis -target http://172.16.1.4:4000/ -bind :4000
18414 daemon: /usr/local/bin/anubis[18440]
Stopping anubis.
Waiting for PIDS: 18440.
20411 /usr/local/bin/anubis -target http://172.16.1.4:4000/ -bind :4000
18414 daemon: /usr/local/bin/anubis[20411]
root@proxy:/tmp #

### -r -P only

# Pastebin ZFGpvb1x
root@proxy:/tmp # pkill -9 -ilf anubis; service anubis start; sleep 5; pgrep
-ilf anubis; service anubis stop; sleep 6; pgrep -ilf anubis
kill -9 20411
kill -9 18414
Starting anubis.
21906 /usr/local/bin/anubis -target http://172.16.1.4:4000/ -bind :4000
21840 daemon: /usr/local/bin/anubis[21906]
anubis not running? (check /var/run/anubis.pid).
21906 /usr/local/bin/anubis -target http://172.16.1.4:4000/ -bind :4000
21840 daemon: /usr/local/bin/anubis[21906]
root@proxy:/tmp #

This should be at least an errata, as it impacts many many daemons in ports in
14.2-RELEASE,
and ideally would get fixed in the next patch release.

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