[nsd-users] PATCH: option to allow nofork without enabling debug mode

Paul Wouters paul at nohats.ca
Thu Apr 18 22:47:31 UTC 2013


On Thu, 18 Apr 2013, Anand Buddhdev wrote:

> Have you tested nsd long enough with this option?

After fixing the patch to add "D" to getopt, I ran it specifically with
various reload scenarios because I know even the RHEL version with sysv
still at times lost the proper pid (the build I fired off today
hopefully fixes those now on RHEL, ns0.nohats.ca has not lost the right
pid in several hours now)

So I did variations of:
systemctl reload nsd.service
nsdc reload
nsdc rebuild
systemctl restart nsd.service

Note that the reload service calls rebuild, reload and notify:

[Unit]
Description=NSD DNS Server
After=syslog.target network.target

[Service]
Type=simple
PIDFile=/var/run/nsd/nsd.pid
EnvironmentFile=-/etc/sysconfig/nsd
ExecStartPre=/usr/sbin/nsdc -c /etc/nsd/nsd.conf rebuild
ExecStart=/usr/sbin/nsd -D -c /etc/nsd/nsd.conf $OTHER_NSD_OPTS
ExecReload=/usr/sbin/nsdc -c /etc/nsd/nsd.conf rebuild
ExecReload=/usr/sbin/nsdc -c /etc/nsd/nsd.conf reload
# notify blocks on misconfigurations - but does show it very loudly
ExecReload=/usr/sbin/nsdc -c /etc/nsd/nsd.conf notify
ExecStop=/usr/sbin/nsdc -c /etc/nsd/nsd.conf patch
ExecStop=/usr/sbin/nsdc -c /etc/nsd/nsd.conf stop
ExecStopPost=/bin/rm -f /var/lib/nsd/xfrd.state

[Install]
WantedBy=multi-user.target

And each time I verified /run/nsd/nsd.pid with "pidof nsd". It matches
every time.

> I'm not certain it
> will work. It will appear to work in the beginning, but when nsd does
> zone transfers, it will fork a child, which will load the zone database,
> and then kill its parents. At this point, systemd may not be able to
> keep track of nsd. At least, this was what I experienced when trying to
> make nsd3 work under Redhat's upstart.

You mean on the primary or secondary?

> Changing this is more work than a simple patch, and Wouter has already
> done this for the upcoming nsd 4, which runs just fine under upstart.
> But it may never make it into nsd 3. Please do correct me if I got it wrong.

I'll do some more tests to ensure this will work (or not). Thanks for
pointing it out.

Paul



More information about the nsd-users mailing list