NetBSD Problem Report #39893

From www@NetBSD.org  Tue Nov 11 12:47:34 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 2B0A763B8A9
	for <gnats-bugs@gnats.netbsd.org>; Tue, 11 Nov 2008 12:47:34 +0000 (UTC)
Message-Id: <20081111124733.EA8EB63B898@narn.NetBSD.org>
Date: Tue, 11 Nov 2008 12:47:33 +0000 (UTC)
From: roy@marples.name
Reply-To: roy@marples.name
To: gnats-bugs@NetBSD.org
Subject: rc.d/ntpd cannot reliably use pidfiles
X-Send-Pr-Version: www-1.0

>Number:         39893
>Category:       bin
>Synopsis:       rc.d/ntpd cannot reliably use pidfiles
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 11 12:50:00 +0000 2008
>Last-Modified:  Sat Feb 21 11:35:00 +0000 2009
>Originator:     Roy Marples
>Release:        NetBSD-5.99.01
>Organization:
>Environment:
NetBSD uberlaptop 5.99.01 NetBSD 5.99.01 (UBERLAPTOP) #1: Wed Nov  5 09:45:08 GMT 2008  roy@uberlaptop:/usr/obj/sys/arch/i386/compile/UBERLAPTOP i386
>Description:
ntpd takes a while to create it's pidfile after forking.
This poses a problem to the rc.d/ntpd script which expects a fully working pidfile.

>How-To-Repeat:
# /etc/rc.d/ntpd restart; /etc/rc.d/ntpd status; /etc/rc.d/ntpd restart; /etc/rc.d/ntpd status
Stopping ntpd.
Waiting for PIDS: 4820.
Starting ntpd.
ntpd is not running.
ntpd not running? (check /var/run/ntpd.pid).
Starting ntpd.
ntpd is running as pid 5134.
>Fix:
Remove the pidfile directive from /etc/rc.d/ntpd and you then get this

# /etc/rc.d/ntpd restart; /etc/rc.d/ntpd status; /etc/rc.d/ntpd restart; /etc/rc.d/ntpd status
Stopping ntpd.
Waiting for PIDS: 5134.
Starting ntpd.
ntpd is running as pid 6335.
Stopping ntpd.
Waiting for PIDS: 6335.
Starting ntpd.
ntpd is running as pid 4852.

I also wrote a patch for ntpd to create the pidfile as early as possible. There is still a window, but it's much smaller.
https://support.ntp.org/bugs/show_bug.cgi?id=794

>Audit-Trail:
From: =?ISO-8859-2?Q?Ond=F8ej_T=F9ma?= <ondra.tu@blackmouse.cz>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/39893
Date: Sat, 21 Feb 2009 12:34:37 +0100

 --Sig_/yWcr9ruPe1H80osGD6a5HOj
 Content-Type: text/plain; charset=ISO-8859-2
 Content-Transfer-Encoding: quoted-printable

 I solve this problem by this patch of ntpd script:

 --- /usr/pkg/share/examples/rc.d/ntpd	2009-02-16 12:48:58.000000000 +0100
 +++ ntpd	2008-07-01 17:06:32.000000000 +0200
 @@ -16,6 +16,7 @@
  pidfile=3D"/var/run/${name}.pid"
  start_precmd=3D"ntpd_precmd"
  required_files=3D"/usr/pkg/etc/ntp.conf"
 +command_args=3D"-p $pidfile"
 =20
  ntpd_precmd()
  {


 --=20
 Ond=F8ej T=F9ma

 Unix-like system is the best operation system from the top of the world.
 I'm lucky BSD and linux user. :) Use unix-like, be free. :)

 www.blackmouse.biz  hash.webjet.cz   mcbig.webjet.cz  IM:mcbig@jabber.cz

 --Sig_/yWcr9ruPe1H80osGD6a5HOj
 Content-Type: application/pgp-signature; name=signature.asc
 Content-Disposition: attachment; filename=signature.asc

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.9 (GNU/Linux)

 iEYEARECAAYFAkmf5s4ACgkQBmNIPxOnb/JSwQCfYmSj0NkaJGk9njX+mpdcPVQH
 sKUAni7lurN3HWGrEuuEzzB5zF6fwn/W
 =ct5E
 -----END PGP SIGNATURE-----

 --Sig_/yWcr9ruPe1H80osGD6a5HOj--

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.