Bug 203580

Summary: Quitting Unbound
Product: Base System Reporter: cyclaero
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Works As Intended    
Severity: Affects Many People CC: des
Priority: ---    
Version: 10.2-RELEASE   
Hardware: Any   
OS: Any   

Description cyclaero 2015-10-06 11:04:02 UTC
Frequently my server hangs on shutting down, and it is always local_unbound that doesn't terminate gracefully in time, but needs to be killed after the shutdown timeout. Usually this happens if the server uptime is more than some days. If I restart it a few times in a short sequence, I experience no shutdown delay. Beyond this, everything works normally.

According to the manual unbound.conf(5) (see section pidfile:), the signal for quitting Unbound gracefully is QUIT, while the default signal for process termination by the way of rc scripts is TERM.

For this reason I suggest to add a respective directive to the rc script "/etc/rc.d/local_unbound":

...
sig_stop="QUIT"
...
Comment 1 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2015-10-13 10:04:16 UTC
If you look at the Unbound source code (`contrib/unbound/daemon/daemon.c` and `contrib/unbound/daemon/worker.c`), you will see that it handles `SIGTERM`, `SIGQUIT` and `SIGINT` identically.  Any difference in behavior between the three exists purely in the mind of the user.
Comment 2 cyclaero 2015-10-14 01:44:10 UTC
If you don't want to change /etc/rc.d/local_unbound, than change unbound.conf(5). If both would have been matched regarding the correct stop signal, then no idiotic user would have raised the question.
Comment 3 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2015-10-14 11:33:31 UTC
(In reply to cyclaero from comment #2)

Not sure what you're trying to achieve by calling users idiots, but yes, I intend to submit a patch to the Unbound developers.
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-10-14 18:09:32 UTC
A commit references this bug:

Author: des
Date: Wed Oct 14 18:08:39 UTC 2015
New revision: 289321
URL: https://svnweb.freebsd.org/changeset/base/289321

Log:
  Apply r3505 (s/SIGQUIT/SIGTERM/ in man page)

  PR:		203580

Changes:
  head/contrib/unbound/doc/unbound.conf.5.in
Comment 5 commit-hook freebsd_committer freebsd_triage 2015-12-04 13:26:28 UTC
A commit references this bug:

Author: des
Date: Fri Dec  4 13:26:12 UTC 2015
New revision: 291767
URL: https://svnweb.freebsd.org/changeset/base/291767

Log:
  MFH (r287917, r287918, r289063): upgrade to latest Unbound
  MFH (r283301, r289592, r291582): rc script improvements
  MFH (r287880): respect manually configured forwarders when using DHCP
  MFH (r289321): deconfuse man page

  PR:		184047 203580 204931

Changes:
_U  stable/10/
  stable/10/contrib/unbound/Makefile.in
  stable/10/contrib/unbound/acx_nlnetlabs.m4
  stable/10/contrib/unbound/compat/getentropy_linux.c
  stable/10/contrib/unbound/compat/reallocarray.c
  stable/10/contrib/unbound/config.h
  stable/10/contrib/unbound/config.h.in
  stable/10/contrib/unbound/configure
  stable/10/contrib/unbound/configure.ac
  stable/10/contrib/unbound/daemon/cachedump.c
  stable/10/contrib/unbound/daemon/daemon.c
  stable/10/contrib/unbound/daemon/remote.c
  stable/10/contrib/unbound/daemon/stats.c
  stable/10/contrib/unbound/daemon/stats.h
  stable/10/contrib/unbound/daemon/worker.c
  stable/10/contrib/unbound/daemon/worker.h
  stable/10/contrib/unbound/dns64/dns64.c
  stable/10/contrib/unbound/dnstap/dnstap.c
  stable/10/contrib/unbound/doc/Changelog
  stable/10/contrib/unbound/doc/README
  stable/10/contrib/unbound/doc/example.conf
  stable/10/contrib/unbound/doc/example.conf.in
  stable/10/contrib/unbound/doc/libunbound.3
  stable/10/contrib/unbound/doc/libunbound.3.in
  stable/10/contrib/unbound/doc/unbound-anchor.8
  stable/10/contrib/unbound/doc/unbound-anchor.8.in
  stable/10/contrib/unbound/doc/unbound-checkconf.8
  stable/10/contrib/unbound/doc/unbound-checkconf.8.in
  stable/10/contrib/unbound/doc/unbound-control.8
  stable/10/contrib/unbound/doc/unbound-control.8.in
  stable/10/contrib/unbound/doc/unbound-host.1
  stable/10/contrib/unbound/doc/unbound-host.1.in
  stable/10/contrib/unbound/doc/unbound.8
  stable/10/contrib/unbound/doc/unbound.8.in
  stable/10/contrib/unbound/doc/unbound.conf.5
  stable/10/contrib/unbound/doc/unbound.conf.5.in
  stable/10/contrib/unbound/iterator/iter_delegpt.c
  stable/10/contrib/unbound/iterator/iter_fwd.c
  stable/10/contrib/unbound/iterator/iter_hints.c
  stable/10/contrib/unbound/iterator/iter_priv.c
  stable/10/contrib/unbound/iterator/iter_resptype.c
  stable/10/contrib/unbound/iterator/iter_scrub.c
  stable/10/contrib/unbound/iterator/iter_utils.c
  stable/10/contrib/unbound/iterator/iter_utils.h
  stable/10/contrib/unbound/iterator/iterator.c
  stable/10/contrib/unbound/iterator/iterator.h
  stable/10/contrib/unbound/ldns/
  stable/10/contrib/unbound/libunbound/context.c
  stable/10/contrib/unbound/libunbound/libunbound.c
  stable/10/contrib/unbound/libunbound/libworker.c
  stable/10/contrib/unbound/libunbound/python/Makefile
  stable/10/contrib/unbound/libunbound/python/examples/async-lookup.py
  stable/10/contrib/unbound/libunbound/python/examples/dns-lookup.py
  stable/10/contrib/unbound/libunbound/python/examples/dnssec-valid.py
  stable/10/contrib/unbound/libunbound/python/examples/dnssec_test.py
  stable/10/contrib/unbound/libunbound/python/examples/example8-1.py
  stable/10/contrib/unbound/libunbound/python/examples/idn-lookup.py
  stable/10/contrib/unbound/libunbound/python/examples/mx-lookup.py
  stable/10/contrib/unbound/libunbound/python/examples/ns-lookup.py
  stable/10/contrib/unbound/libunbound/python/examples/reverse-lookup.py
  stable/10/contrib/unbound/libunbound/python/file_py3.i
  stable/10/contrib/unbound/libunbound/python/libunbound.i
  stable/10/contrib/unbound/libunbound/worker.h
  stable/10/contrib/unbound/services/cache/dns.c
  stable/10/contrib/unbound/services/cache/infra.c
  stable/10/contrib/unbound/services/cache/infra.h
  stable/10/contrib/unbound/services/cache/rrset.c
  stable/10/contrib/unbound/services/listen_dnsport.c
  stable/10/contrib/unbound/services/listen_dnsport.h
  stable/10/contrib/unbound/services/localzone.c
  stable/10/contrib/unbound/services/localzone.h
  stable/10/contrib/unbound/services/mesh.c
  stable/10/contrib/unbound/services/outside_network.c
  stable/10/contrib/unbound/sldns/
  stable/10/contrib/unbound/sldns/rrdef.h
  stable/10/contrib/unbound/smallapp/unbound-anchor.c
  stable/10/contrib/unbound/smallapp/unbound-checkconf.c
  stable/10/contrib/unbound/smallapp/unbound-control-setup.sh
  stable/10/contrib/unbound/smallapp/unbound-control-setup.sh.in
  stable/10/contrib/unbound/smallapp/unbound-control.c
  stable/10/contrib/unbound/smallapp/unbound-host.c
  stable/10/contrib/unbound/util/alloc.c
  stable/10/contrib/unbound/util/alloc.h
  stable/10/contrib/unbound/util/config_file.c
  stable/10/contrib/unbound/util/config_file.h
  stable/10/contrib/unbound/util/configlexer.lex
  stable/10/contrib/unbound/util/configparser.y
  stable/10/contrib/unbound/util/data/dname.c
  stable/10/contrib/unbound/util/data/msgencode.c
  stable/10/contrib/unbound/util/data/msgparse.c
  stable/10/contrib/unbound/util/data/msgparse.h
  stable/10/contrib/unbound/util/data/msgreply.c
  stable/10/contrib/unbound/util/data/msgreply.h
  stable/10/contrib/unbound/util/data/packed_rrset.c
  stable/10/contrib/unbound/util/data/packed_rrset.h
  stable/10/contrib/unbound/util/fptr_wlist.c
  stable/10/contrib/unbound/util/iana_ports.inc
  stable/10/contrib/unbound/util/log.c
  stable/10/contrib/unbound/util/log.h
  stable/10/contrib/unbound/util/net_help.c
  stable/10/contrib/unbound/util/netevent.c
  stable/10/contrib/unbound/util/netevent.h
  stable/10/contrib/unbound/validator/autotrust.c
  stable/10/contrib/unbound/validator/val_anchor.c
  stable/10/contrib/unbound/validator/val_kentry.c
  stable/10/contrib/unbound/validator/val_neg.c
  stable/10/contrib/unbound/validator/val_nsec3.c
  stable/10/contrib/unbound/validator/val_secalgo.c
  stable/10/contrib/unbound/validator/val_sigcrypt.c
  stable/10/contrib/unbound/validator/validator.c
  stable/10/etc/rc.d/local_unbound
  stable/10/lib/libunbound/Makefile
  stable/10/usr.sbin/unbound/local-setup/local-unbound-setup.sh