[Pdns-users] What signal to tell PDNS to shut down?
Brian Candler
b.candler at pobox.com
Sun Jan 13 20:32:33 UTC 2019
On 13/01/2019 18:27, Nick Williams wrote:
> I’m working on a Docker container to run my PDNS Authoritative
> servers. I’m installing PDNS from repo.powerdns.com
> <http://repo.powerdns.com>. The Docker command that is run in
> `pdns_server`. The `docker stop` command sends a `SIGTERM` to PID 1,
> waits some amount of time, and then sends SIGKILL to force it to stop.
> It’s having to resort to SIGKILL, because `pdns_server` doesn’t
> respond to `SIGTERM`. What is the correct signal to tell PDNS to shut
> down?
The problem is not with pdns, it's with docker: strange things happen if
you run the application as pid 1. For an explanation see:
https://hackernoon.com/my-process-became-pid-1-and-now-signals-behave-strangely-b05c52cc551c
Solution: run a different pid 1 process whose job it is to launch the
application, such as tini:
https://github.com/krallin/tini
With a modern version of docker, tini is included. Just use the --init
flag to docker run, and it should all be fine.
Regards,
Brian.
P.S. You can easily show that pdns is happy with a SIGTERM when you run
it outside of docker.
root at ns2:~# ps auxwww | grep pdns
pdns 1612 0.0 0.7 677608 8064 ? Ssl 2018 16:37
/usr/sbin/pdns_server --guardian=no --daemon=no --disable-syslog
--write-pid=no
root 25477 0.0 0.0 12944 968 pts/0 S+ 20:24 0:00 grep
--color=auto pdns
root at ns2:~# kill -TERM 1612
root at ns2:~# ps auxwww | grep pdns
root 25486 0.0 0.0 12944 940 pts/0 S+ 20:24 0:00 grep
--color=auto pdns
root at ns2:~#
This is pdns-server 4.0.6 under Ubuntu 16.04, with mysql backend.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.powerdns.com/pipermail/pdns-users/attachments/20190113/219b063c/attachment.html>
More information about the Pdns-users
mailing list