Article View: comp.protocols.time.ntp
Article #1Re: ntpd does not start daemon control: got EOF
From: Cy Schubert
Date: Tue, 28 Apr 2026 04:38
Date: Tue, 28 Apr 2026 04:38
183 lines
10556 bytes
10556 bytes
Ignore the typo in the patch. I can't type.
--
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX: <cy@FreeBSD.org> Web: https://FreeBSD.org
NTP: <cy@nwtime.org> Web: https://nwtime.org
e**(i*pi)+1=0
In message <20260428042726.C382CE2@slippy.cwsent.com>, Cy Schubert writes:
> In message <d3493e70-2276-4c63-a4a4-7de5e6518cc0@ntp.org>, "Harlan Stenn"
> write
> s:
> > On 4/27/2026 4:33 PM, Cy Schubert wrote:
> > > In message <c125bd87-a762-4468-b214-5ead5147b82c@ntp.org>, "Harlan Stenn"
> > > write
> > > s:
> > >> On 4/27/2026 12:59 PM, Cy Schubert wrote:
> > >>> In message <CAMbSiYD=phHqGb=DjmYoZmYOjXWvv1r+TLex=ZjiyZHfaPYBAA@mail.gm
> ai
> > l.
> > >> c
> > >>> om>
> > >>> , Dave Hart writes:
> > >>>>
> > >>>> On Mon, Apr 27, 2026 at 14:11=E2=80=AFUTC Cy Schubert wrote:
> > >>>>
> > >>>>> The issue with ntpd is that it forks a subprocess, with a pipe betwee
> n
> > >>>>> both
> > >>>>> processes. The child process write "R\n" to the pipe. If the parent d
> oe
> > s
> > >>>>> not read two bytes it exits with an error. Just a guess here that mon
> it
> > >>>>> might have its fingers in the pipe.
> > >>>>>
> > >>>>
> > >>>> ntpd does have --nofork/-n to avoid forking to daemonize. I have not
> > >>>> tested, but intuitively it seems like a better solution for FreeBSD's
> rc
> > .d
> > >>>> script.
> > >>>>
> > >>>
> > >>> I suppose users of monit could use that. rcng uses the .pid file to man
> ag
> > e
> > >>> services. I don't see any benefit of changing the FreeBSD rc file to
> > >>> support an esoteric process monitoring application. Applications should
> > >>> conform to and work within the O/S, not the other way around. Though no
> t
> > >>> posix pidfiles are a common UNIX-like management tool.
> > >>
> > >> We believe we provide a robust mechanism for ntpd startup. If there is
> > >> missing functionality here, please open a bug report.
> > >>
> > >> There are a staggering number of systems out there that use a myriad of
> > >> different startup schemes. Any given system can undergo spontaneous
> > >> changes in its startup framework.
> > >>
> > >> It seems unreasonable to me to expect *any* application project
> > >> (including NTP) to conform to an OS.
> > >>
> > >> But it *is* perfectly reasonable to expect an application project to
> > >> offer command-line and configuration options that are sufficiently
> > >> robust to allow an arbitrary OS to reliably start/stop the application.
> > >>
> > >> Are we agreed on this?
> > >
> > > In this regard ntp (and sendmail) are working correctly. The issue only
> > > occurs when run under monit. Monit might be inserting itself between the
> > > parent and the child in order to cause the parent not to read "R\n" on th
> e
> > > pipe.
> >
> > Cool, thanks!
> >
> > > I have confirmed, in a jail on a 16-CURRENT system, that the problem only
> > > occurs under monit. This is why I suggested the O/P open a bugzilla bug f
> or
> > > the problem. It's one of the following:
> > >
> > > - a monit bug, or
> > > - a bug uncovered by monit in the FreeBSD kernel or libc.
> > >
> > > What ntpd is doing by opening a pipe so the child can notify the parent i
> t
> > > can terminate itself looks reasonable.
> > >
> > >
> > >>
> > >> --
> > >> Harlan Stenn <stenn@ntp.org>
> > >> NTP Project Lead. The NTP Project is part of:
> > >> https://www.nwtime.org/ - be a member!
> > >
> > >
> >
> > --
> > Harlan Stenn <stenn@ntp.org>
> > NTP Project Lead. The NTP Project is part of:
> > https://www.nwtime.org/ - be a member!
>
> I'll try to nail this down this week. Just to rule out whether the child is
> terminating the following DTrace probes will, hopefully, point me in a
> direction to better understand this.
>
> diff --git a/contrib/ntp/ntpd/ntpd.c b/contrib/ntp/ntpd/ntpd.c
> index b64caae06da1..6095e2144925 100644
> --- a/contrib/ntp/ntpd/ntpd.c
> +++ b/contrib/ntp/ntpd/ntpd.c
> @@ -134,6 +134,9 @@
> # include <sys/resource.h>
> # include <seccomp.h>
> #endif /* LIBSECCOMP and KERN_SECCOMP */
> +#if defined(__FreeBSD__)
> +#include <sys.sdt.h>
> +#endif
>
> #if defined(__FreeBSD__) && __FreeBSD_version < 1400037 &&
> defined(HAVE_SYS_PROCCTL_H)
> # include <sys/procctl.h>
> @@ -1444,7 +1447,15 @@ int scmp_sc[] = {
> if (daemon_pipe[1] != -1 && 0 == wait_sync) {
> if (2 != write(daemon_pipe[1], "R\n", 2)) {
> msyslog(LOG_ERR, "daemon failed to notify parent ntpd a
> fter init");
> +#if defined(__FreeBSD__)
> + DTRACE_PROBE(ntpd, child_notify_parent_fail)
> +#endif
> }
> +#if defined(__FreeBSD__)
> + else {
> + DTRACE_PROBE(ntpd, child_notify_success)
> + }
> +#endif
> close(daemon_pipe[1]);
> daemon_pipe[1] = -1;
> }
> @@ -1694,16 +1705,25 @@ wait_child_sync_if(
> if (rc == 0) {
> /* DPRINTF is useless here as -d/-D disable forking */
> fprintf(stderr, "daemon control: got EOF\n");
> +#if defined(__FreeBSD__)
> + DTRACE_PROBE(ntpd, parent_got_eof)
> +#endif
> return -1; /* unexpected EOF, check daemon */
> } else if (rc == 1) {
> if ( ('S' == ch && wait_sync > 0)
> || ('R' == ch && 0 == wait_sync)) {
> +#if defined(__FreeBSD__)
> + DTRACE_PROBE(ntpd, parent_got_char)
> +#endif
> return 0;
> }
> } else {
> mfprintf(stderr, "%s: daemon control: read 1 char faile
> d: %m\n",
> progname);
> msyslog(LOG_ERR, "daemon control: read 1 char failed: %
> m");
> +#if defined(__FreeBSD__)
> + DTRACE_PROBE(ntpd, parent_pipe_read_fail)
> +#endif
> return EX_IOERR;
> }
> } while (wait_rem > 0);
>
>
> --
> Cheers,
> Cy Schubert <Cy.Schubert@cschubert.com>
> FreeBSD UNIX: <cy@FreeBSD.org> Web: https://FreeBSD.org
> NTP: <cy@nwtime.org> Web: https://nwtime.org
>
> e**(i*pi)+1=0
>
Technical Details
Message-ID:
<20260428043128.C0F58236@slippy.cwsent.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!weretis.net!feeder9.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!not-for-mailReferences:
<20260427233300.9B7B8CE@slippy.cwsent.com> <c932db69-7d5c-401e-aea1-83295f3e66ad@dorfdsl.de> <10sb1b9$3j4cj$3@paganini.bofh.team> <10sc8ha$3r263$1@paganini.bofh.team> <20260427151055.E6833381@slippy.cwsent.com> <20260428042726.C382CE2@slippy.cwsent.com> <CAMbSiYD=phHqGb=DjmYoZmYOjXWvv1r+TLex=ZjiyZHfaPYBAA@mail.gmail.com> <10s8lfs$1n3e3$16@dont-email.me> <8d050e53-2600-4f2d-a504-15780b0d53cb@ntp.org> <f2767d42-f578-4553-9e8a-d1e2d2c2e151@ntp.org> <c125bd87-a762-4468-b214-5ead5147b82c@ntp.org> <10Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!weretis.net!feeder9.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!not-for-mail From: "Cy Schubert" <Cy.Schubert@cschubert.com> Newsgroups: comp.protocols.time.ntp Subject: Re: ntpd does not start daemon control: got EOF Date: Tue, 28 Apr 2026 04:38:00 -0000 (UTC) Organization: Taughannock Networks, Trumansburg NY Message-ID: <20260428043128.C0F58236@slippy.cwsent.com> References: <20260427233300.9B7B8CE@slippy.cwsent.com> <c932db69-7d5c-401e-aea1-83295f3e66ad@dorfdsl.de> <10sb1b9$3j4cj$3@paganini.bofh.team> <10sc8ha$3r263$1@paganini.bofh.team> <20260427151055.E6833381@slippy.cwsent.com> <20260428042726.C382CE2@slippy.cwsent.com> <CAMbSiYD=phHqGb=DjmYoZmYOjXWvv1r+TLex=ZjiyZHfaPYBAA@mail.gmail.com> <10s8lfs$1n3e3$16@dont-email.me> <8d050e53-2600-4f2d-a504-15780b0d53cb@ntp.org> <f2767d42-f578-4553-9e8a-d1e2d2c2e151@ntp.org> <c125bd87-a762-4468-b214-5ead5147b82c@ntp.org> <10 Reply-To: "Cy Schubert" <Cy.Schubert@cschubert.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Tue, 28 Apr 2026 04:38:00 -0000 (UTC) Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="18172"; mail-complaints-to="abuse@iecc.com" To: "Harlan Stenn" <stenn@ntp.org>, "Dave Hart" <davehart@gmail.com>, "Marco Moock" <mm@dorfdsl.de>, questions@lists.ntp.org Return-Path: <questions-owner@lists.ntp.org> Delivered-To: ntpquestions@iecc.com Errors-To: questions-owner@lists.ntp.org X-Spam-Checker-Version: SpamAssassin 4.0.2 (2025-08-27) on gal.iecc.com X-Spam-Status: No, score=-3.1 required=4.4 tests=BAYES_00,DCC_REPUT_00_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=4.0.2 Authentication-Results: iecc.com; spf=pass spf.mailfrom=questions-owner@lists.ntp.org spf.helo=mail0.chi1.ntfo.org smtp.remote-ip="204.93.207.17"; dkim=pass header.d=lists.ntp.org header.s=mail header.a=rsa-sha256 header.b="rX/GJYcv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ntp.org; s=mail; t=1777350715; bh=Nc08TK6vyWdzKUhVOvlhqlB1y75lxZdXnrZFY44lSDk=; h=Reply-to:From:To:Subject:In-reply-to:References:Mime-Version: Content-Type:Date:Message-Id:Sender:List-Id:List-Help: List-Subscribe:List-Unsubscribe:List-Post:List-Owner:List-Archive; b=rX/GJYcvwDMkfbZHyK4grG9jFfYSeVB2YJudn0yePCZAq6HCcYPAG4gCJizOxaU3f HB+XB5Z2iyfAW+FggC9trSxa995ui8jYd7a4/inNVpqjtX9VCuq01Ed3VgHadkicO/ rV/AEDxMPC7/6FuaxbX1wmIwtxLLTI06a+iPX Authentication-Results: ; auth=pass (LOGIN) smtp.auth=cschuber@shaw.ca X-Auth-User: cschuber X-Authority-Analysis: v=2.4 cv=BoaQAIX5 c=1 sm=1 tr=0 ts=69f03822 a=h7br+8Ma+Xn9xscxy5znUg==:117 a=h7br+8Ma+Xn9xscxy5znUg==:17 a=kj9zAlcOel0A:10 a=A5OVakUREuEA:10 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=YxBL1-UpAAAA:8 a=VxmjJ2MpAAAA:8 a=85N1-lAfAAAA:8 a=tF8mk995K4Kj92uFW8QA:9 a=CjuIK1q_8ugA:10 a=LK5xJRSDVpKd5WXXoEvA:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=7gXAzLPJhVmCkEl4_tsf:22 a=cyfSibbquD4hpIoiQNSb:22 X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http: //www.cschubert.com/ In-reply-to: <20260428042726.C382CE2@slippy.cwsent.com> Comments: In-reply-to Cy Schubert <Cy.Schubert@cschubert.com> message dated "Mon, 27 Apr 2026 21:27:26 -0700." X-CMAE-Envelope: MS4xfBZMlfbxciuxJqf0RLOZ0H6NNPmcy3CQ2L0fZe2SgHAL6/G4iF49g3d58Xb1SUxRmwNtCiyIJM8R07PRzc749uLIa9rN8FBDReifknRH87DvsbqlDaKC MiAUkY3ZVw7+N/skhaOxdSmJuNsli/wE0PljFkyRQ6bhC+VCDlCRqWGcNd/SGqHMHh3/W5zmvqyDGgYIKUCz37zr33xYotlsvCEILHDQ60gZKLSJHBg8DTW/ 6UgFqwAuRmJKrnfxzWvKcaiVVX+LHy48x06OKiGQNccC1oKzDXaltCwsLfL9f8xB X-Loop: questions@lists.ntp.org List-Id: <questions.lists.ntp.org> List-Help: <https: //lists.ntp.org/sympa/help>, <mailto:sympa@lists.ntp.org?subject=HELP> List-Subscribe: <https: //lists.ntp.org/sympa/subscribe/questions>, <mailto:sympa@lists.ntp.org?subject=SUB%20questions> List-Unsubscribe: <https: //lists.ntp.org/sympa/signoff/questions>, <mailto:sympa@lists.ntp.org?subject=SIG%20questions> List-Post: <mailto: questions@lists.ntp.org> List-Owner: <mailto: questions-request@lists.ntp.org> List-Archive: <https: //lists.ntp.org/sympa/arc/questions> X-Original-DMARC-Record: domain=cschubert.com; v=DMARC1; p=quarantine rua=mailto: p[ostmaster@cschubert.com X-DCC-iecc-Metrics: gal.iecc.com 1107; Body=1 Fuz1=1 Fuz2=1 Mail-to-news: iecc.com