Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.protocols.time.ntp > #164285
| From | "Cy Schubert" <Cy.Schubert@cschubert.com> |
|---|---|
| Newsgroups | comp.protocols.time.ntp |
| Subject | Re: ntpd does not start daemon control: got EOF |
| Date | 2026-04-28 04:38 +0000 |
| Organization | Taughannock Networks, Trumansburg NY |
| Message-ID | <20260428043128.C0F58236@slippy.cwsent.com> (permalink) |
| References | (6 earlier) <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> |
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
>
Back to comp.protocols.time.ntp | Previous — Previous in thread | Next in thread | Find similar
ntpd does not start daemon control: got EOF Marco Moock <mm@dorfdsl.de> - 2026-04-21 21:08 +0200
Re: ntpd does not start daemon control: got EOF "Harlan Stenn via questions Mailing List" <questions@lists.ntp.org> - 2026-04-21 19:58 +0000
Re: ntpd does not start daemon control: got EOF Marco Moock <mm@dorfdsl.de> - 2026-04-21 22:08 +0200
Re: ntpd does not start daemon control: got EOF "Dave Hart via questions Mailing List" <questions@lists.ntp.org> - 2026-04-21 20:58 +0000
Re: ntpd does not start daemon control: got EOF Marco Moock <mm@dorfdsl.de> - 2026-04-22 19:43 +0200
Re: ntpd does not start daemon control: got EOF "Dave Hart" <davehart@gmail.com> - 2026-04-27 19:43 +0000
Re: ntpd does not start daemon control: got EOF "Cy Schubert" <Cy.Schubert@cschubert.com> - 2026-04-27 20:03 +0000
Re: ntpd does not start daemon control: got EOF "Harlan Stenn via questions Mailing List" <questions@lists.ntp.org> - 2026-04-27 21:38 +0000
Re: ntpd does not start daemon control: got EOF "Cy Schubert" <Cy.Schubert@cschubert.com> - 2026-04-28 04:38 +0000
Re: ntpd does not start daemon control: got EOF "Harlan Stenn via questions Mailing List" <questions@lists.ntp.org> - 2026-04-22 22:03 +0000
Re: ntpd does not start daemon control: got EOF Marco Moock <mm@dorfdsl.de> - 2026-04-23 06:51 +0200
Re: ntpd does not start daemon control: got EOF "Cy Schubert" <Cy.Schubert@cschubert.com> - 2026-04-25 05:28 +0000
Re: ntpd does not start daemon control: got EOF "Harlan Stenn via questions Mailing List" <questions@lists.ntp.org> - 2026-04-28 00:08 +0000
Re: ntpd does not start daemon control: got EOF "Harlan Stenn via questions Mailing List" <questions@lists.ntp.org> - 2026-04-22 22:13 +0000
Re: ntpd does not start daemon control: got EOF "Harlan Stenn via questions Mailing List" <questions@lists.ntp.org> - 2026-04-21 20:43 +0000
Re: ntpd does not start daemon control: got EOF Marco Moock <mm@dorfdsl.de> - 2026-04-22 05:25 +0200
Re: ntpd does not start daemon control: got EOF "Harlan Stenn via questions Mailing List" <questions@lists.ntp.org> - 2026-04-21 21:03 +0000
Re: ntpd does not start daemon control: got EOF "Alexander Ziaee" <ziaee@FreeBSD.org> - 2026-04-22 10:03 +0000
Re: ntpd does not start daemon control: got EOF Marco Moock <mm@dorfdsl.de> - 2026-04-22 12:37 +0200
Re: ntpd does not start daemon control: got EOF "Alexander Ziaee" <ziaee@FreeBSD.org> - 2026-04-22 14:33 +0000
Re: ntpd does not start daemon control: got EOF "Cy Schubert" <Cy.Schubert@cschubert.com> - 2026-04-22 14:58 +0000
Re: ntpd does not start daemon control: got EOF "Marco Moock" <mm@dorfdsl.de> - 2026-04-22 16:18 +0000
Re: ntpd does not start daemon control: got EOF "Cy Schubert" <Cy.Schubert@cschubert.com> - 2026-04-27 15:13 +0000
Re: ntpd does not start daemon control: got EOF "Marco Moock" <mm@dorfdsl.de> - 2026-04-27 16:13 +0000
Re: ntpd does not start daemon control: got EOF "Cy Schubert" <Cy.Schubert@cschubert.com> - 2026-04-28 04:33 +0000
Re: ntpd does not start daemon control: got EOF "Dave Hart" <davehart@gmail.com> - 2026-04-22 18:33 +0000
Re: ntpd does not start daemon control: got EOF Marco Moock <mm@dorfdsl.de> - 2026-04-22 20:54 +0200
Re: ntpd does not start daemon control: got EOF "Cy Schubert" <Cy.Schubert@cschubert.com> - 2026-04-23 04:13 +0000
Re: ntpd does not start daemon control: got EOF "Marco Moock" <mm@dorfdsl.de> - 2026-04-25 09:38 +0000
Re: ntpd does not start daemon control: got EOF "Ralph Blach" <chip.from.nc@gmail.com> - 2026-04-27 20:08 +0000
Re: ntpd does not start daemon control: got EOF "Cy Schubert" <Cy.Schubert@cschubert.com> - 2026-04-27 23:38 +0000
csiph-web