[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 17:51:12 UTC 2013


On Sat, Jun 08, 2013 at 02:45:32PM +0200, Sergio Gelato wrote:
> On Fri, 7 Jun 2013 22:11:30 +0200, Kurt Roeckx <kurt at roeckx.be> wrote:
> > But you started a new one, which wrote a PID file, and then it
> > died because it detected that an other ntpd was still running,
> > and you really [only] want 1 running.  It probably shouldn't have
> > written the pid file in that case.
> 
> I now have an instance of the problem occurring naturally on a squeeze
> system (so the trigger mechanism isn't Ubuntu-only, one can't blame it on
> upstart in this case), and I can confirm that it is associated with
> attempts by the system to start two ntpd processes concurrently. Arranging
> for the instance that loses the race not to have its PID written to the
> file should be very helpful, I think.
> 
> 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.

Why does it get started twice?  The restart is probably triggered
by /etc/dhcp/dhclient-exit-hooks.d/ntp

Looking at the init script, "status" doesn't use the pid file
currently.  So it's just going to look at the processes.  So
I don't see how status is going to react differently that puppet.
Note also how it did properly say it's running in your example,
even when the PID file is wrong.


Kurt



More information about the pkg-ntp-maintainers mailing list