# Quitting Unbound



## obsigna (Oct 6, 2015)

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.

I researched the Unbound documentation, and I found that the signal for quitting Unbound gracefully is QUIT:
`man unbound.conf | grep -C1 kill`

```
--
         "/var/unbound/unbound.pid".  So,
         kill -HUP    `cat /var/unbound/unbound.pid`
         triggers a reload,
         kill -QUIT `cat /var/unbound/unbound.pid`
         gracefully terminates.
```
The default signal of the rc stop subroutine is TERM which is mentioned nowhere in the Unbound documentation.

I added the configuration setting sig_stop="QUIT" to the file /etc/rc.d/local_unbound, and for now I can tell only that this stops Unbound on my server as well. Whether this resolved the issue, I will only be able to tell when restarting my server after some days of uptime. Anyway, I guess, just already for sanity reasons it would be good to inform the rc script the correct signal for stopping a service gracefully.


----------



## obsigna (Oct 6, 2015)

I submitted a bug report, see Bug 203580.


----------



## mb2015 (Oct 14, 2015)

des replied to the bug report, saying SIGTERM, SIGQUIT, SIGINT are all treated the same by Unbound, so your slow shutdown problem must be due to something else.

I would suggest running Unbound in debug mode, e.g. put `local_unbound_flags="-v"` in /etc/rc.conf, then `service local_unbound restart`. You can add more `v`s for more verbosity, e.g. `-vvv`. You will get much output in /var/log/debug.log, assuming you still have syslog.conf configured to put debug-level messages there.


----------

