saned child process remains after main process is terminated
I have an issue when SANE is built with Avahi support. saned
will spawn a child process for Avahi functionality that remains even after the main process is terminated.
The child process (pid 1429) can be seen below.
$ ps
1428 _saned _saned 0.0 0.0 16164 6088 ? S 18:57:06 00:00:00 saned -l -u _saned -d128
1429 _saned _saned 0.0 0.0 16164 548 ? S 18:57:06 00:00:00 saned -l -u _saned -d128
$ svlogtail
2021-07-08T08:57:06.35901 daemon.debug: Jul 8 18:57:06 saned[1428]: read_config: searching for config file
2021-07-08T08:57:06.35906 daemon.debug: Jul 8 18:57:06 saned[1428]: read_config: done reading config
2021-07-08T08:57:06.35909 daemon.debug: Jul 8 18:57:06 saned[1428]: saned (AF-indep+IPv6) from sane-backends 1.0.32 starting up
2021-07-08T08:57:06.35911 daemon.debug: Jul 8 18:57:06 saned[1428]: do_bindings: trying to get port for service "sane-port" (getaddrinfo)
2021-07-08T08:57:06.36066 daemon.debug: Jul 8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul 8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36066 daemon.debug: Jul 8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul 8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36070 daemon.debug: Jul 8 18:57:06 saned[1428]: do_bindings: [1] bind () to port 6566
2021-07-08T08:57:06.36072 daemon.debug: Jul 8 18:57:06 saned[1428]: do_bindings: [1] listen ()
2021-07-08T08:57:06.36076 daemon.debug: Jul 8 18:57:06 saned[1428]: do_bindings: [0] socket () using IPv4
2021-07-08T08:57:06.36077 daemon.debug: Jul 8 18:57:06 saned[1428]: do_bindings: [0] setsockopt ()
2021-07-08T08:57:06.36079 daemon.debug: Jul 8 18:57:06 saned[1428]: do_bindings: [0] bind () to port 6566
2021-07-08T08:57:06.36080 daemon.debug: Jul 8 18:57:06 saned[1428]: do_bindings: [0] bind failed: Address already in use
2021-07-08T08:57:06.36083 daemon.debug: Jul 8 18:57:06 saned[1428]: Dropped privileges to uid 993 gid 990
2021-07-08T08:57:06.36084 daemon.debug: Jul 8 18:57:06 saned[1428]: run_standalone: spawning Avahi process
2021-07-08T08:57:06.36101 daemon.debug: Jul 8 18:57:06 saned[1428]: run_standalone: waiting for control connection
2021-07-08T08:57:06.36204 daemon.debug: Jul 8 18:57:06 saned[1429]: saned_avahi_callback: AVAHI_CLIENT_CONNECTING
I'm using Void Linux which uses the runit supervision suite to run system services and daemons. Here is the runit script for saned
:
#!/bin/sh
[ -r ./conf ] && . ./conf
exec saned -l -u _saned ${OPTS}
runit is able to stop the main process but the child process remains. After repeated service restarts there will be many child processes remaining. Is this expected behavior?