[pkg-ntp-maintainers] Bug#711548: Bug#711548: Fragile handling of pidfile by /etc/init.d/ntp

Kurt Roeckx kurt at roeckx.be
Sat Jun 8 21:38:26 UTC 2013


On Sat, Jun 08, 2013 at 11:13:22PM +0200, Sergio Gelato wrote:
> On Sat, 8 Jun 2013 19:51:12 +0200, Kurt Roeckx <kurt at roeckx.be> wrote:
> >> 
> >> Here are some relevant logs about the incident, lightly sanitised:
> >> 
> >> Jun  7 08:17:18 <HOST> dhclient: DHCPACK from <SERVERIP>
> >> Jun  7 08:17:18 <HOST> ntpd[1576]: ntpd exiting on signal 15
> >> Jun  7 08:17:20 <HOST> ntpd[1904]: ntpd 4.2.6p2 at 1.2194-o Sun Oct 17
> >> 13:35:13 UTC 2010 (1)
> >> Jun  7 08:17:20 <HOST> ntpd[1905]: ntpd 4.2.6p2 at 1.2194-o Sun Oct 17
> >> 13:35:13 UTC 2010 (1)
> > 
> > So you're starting it twice at the same time?  Of course there is
> > no PID file yet at the time the 2nd gets started.
> 
> A race, as I said. And the problem isn't so much that multiple instances
> get started at the same time

I would call this a bug somewhere that causes a race condition
somewhere else.  There really is no excuse for starting ntpd twice
at the same time.

That of course doesn't mean we shouldn't deal with writing a pid
file and then die (and not clean up that pid file.)

> > Looking at the init script, "status" doesn't use the pid file
> > currently.
> 
> I beg to differ. It calls status_of_proc, which is defined in
> /lib/lsb/init-functions. status_of_proc in turn calls pidofproc, which has
>     if [ ! "$specified" ]; then
>         pidfile="/var/run/$base.pid"
>     fi

I guess I didn't look hard enough, and that's a little unexpected
behaviour for me.


Kurt



More information about the pkg-ntp-maintainers mailing list