Hi,
the problem with cleaning after itself is when Knot is run under different user.
After the privileges are dropped, the ownership of the file changes as well - so far no problems.
But what happens is, that this file is usually in a directory where that user has no write access to, so it can
read the file,update it, but it can't remove it from that directory.
Therefore, it should be up to script ultimately to remove the PID file after that happens.
Alternatively, you could force delete the PID file with 'knotc -f start'.
When that approach is not so usable (supervised run), I agree that the PID file shouldn't be mandatory,
although 'knotc restart|stop' wouldn't work then for apparent reason.
And yes, it could check the PID file for liveness at startup as well.
I'll add both to the 1.3 final then, you made the case :)
Kind regards,
Marek
On 17 June 2013 16:18, Anand Buddhdev
<anandb@ripe.net> wrote:
Dear knot users/developers,
I'm testing Knot 1.3.0-rc2. One issue I've run into is when knot exits
uncleanly. In this case, it leaves its PID file behind in
/var/lib/knot/knot.pid.
On the following attempt to start knot, it sees the PID file, and
refuses to start, so I have to remove the stale PID file by hand. If I
run knot under a supervisor, such as upstart, then it tries to run knot,
fails, tries again rapidly in succession, and eventually gives up, at
which point knot isn't running.
My first observation is that in cases where knot is running under a
supervisor, the PID file is not necessary. The supervisor knows knot's
PID, and can signal it directly (to reload, or stop). Could you consider
making the PID file optional? As in, if in knot.conf, I have:
pidfile "";
then knot should not attempt to write (or read or delete) a PID file at all.
Alternatively, could you make knot a bit smarter so that if it detects a
PID file at startup, but that PID is either not in use, or the process
using it is not knot, then it should remove the PID file?
Without either of these possibilities, I have to add logic in my startup
scripts or supervisor scripts to remove any stale PID files. If I only
had one instance of knot, I could do that simply with "rm -f
/var/lib/knot/knot.pid", but I'd like to run multiple instances of knot,
and so I would have multiple PID files, whose locations I would have to
extract from the config file first in order to delete them reliably.
This starts to get hairy...
I hope I have made a reasonable case for providing an option to not
record a PID file, or clean up one before starting. My preference is for
the first option, ie. not writing a PID file.
Regards,
Anand Buddhdev
RIPE NCC
_______________________________________________
knot-dns-users mailing list
knot-dns-users@lists.nic.cz
https://lists.nic.cz/cgi-bin/mailman/listinfo/knot-dns-users