From Newsgroup: comp.protocols.time.ntp
--00000000000017cf8706277a0a49
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Thu, Nov 21, 2024 at 4:56=E2=80=AFPM Brian Inglis <
Brian.Inglis@systematicsw.ab.ca> wrote:
On 2024-11-20 14:32, Roger wrote:
On Wed, 20 Nov 2024 19:53:00 -0000 (UTC), Brian Inglis wrote:
Maybe add "iburst preempt" options and drop "poll 11" or perhaps change
to
"maxpoll 11" or higher, unless you have very good reasons to require a longer
interval than the default maximum, instead of adaptive polling based o=
n
the error.
Well, the documentation (confopt) tells me that the pool command
"mobilizes a preemptable pool client mode association for the
DNS name specified." Why would adding "preempt" change anything?
It *may* be required and can never hurt:
In fact it won't change anything. The only options propagated from the "
pool" directive in ntp.conf (and thereby set on the prototype pool
association listed with refid POOL in the peers billboard) to the resulting pool server associations are "iburst" and "noselect". See POOL_FLAG_PMASK
in source code file ntp_proto.c.
The preemptible option is forced on for pool servers, so they are
preemptible with or without that option. However, that option doesn't do
much in 4.2.8 as the code intended to preempt useless servers has an
off-by-one error that's corrected in my test 3792 release, so preemption
only happens in the unusual case where there are more than 2 times as many
pool or manycast client associations as "tos maxclock" which defaults to
10. Arguably this could be fixed in the stable 4.2.8 branch but it would
be a substantial change in behavior without any configuration change that
might break existing setups that depend on the off-by-one error.
As an aside, using "preempt" on a non-pool non-manycastclient association (basically, configured via "server" or "peer") seems quixotic to me, as it allows the association to be removed but nothing is done to replace it. I
have a difficult time imagining where that might be useful. It may have
been useful in the pre-2009 implementation of "pool" which I'm having a
hard time remembering because I thought it was primitive and needed improvement, as it did all its work at startup and never changed the
servers selected once up and running. I re-implemented it to the current iteration, but didn't catch that the preemption was suffering the aforementioned off-by-one error, or it wasn't back then.
If you're wondering why I mentioned "manycastclient", it shares much of the implementation with "pool". They use different approaches to finding
servers, but the rest of the code is common. Both are intended to be
automatic server discovery schemes that discard, or preempt, servers which haven't been useful for 10 poll intervals so that another server can be solicited to replace it.
$ grep 'pool.*preempt' ~/src/time/ntp/ntp-4.2.8p18/ntpd/complete.conf.in
pool 2.ubuntu.pool.ntp.org. iburst preempt
complete.conf.in is part of the "make check" tests and is not intended to suggest useful configurations. Rather it's used both to ensure every
keyword in the configuration file parser is covered, and to ensure a configuration can successfully round-trip through ntpd's reading and
applying the configuration and exporting the configuration via the --saveconfigquit command-line option added specifically for that developer
test to catch changes which break that functionality. It's no coincidence =
it
is ordered exactly the same as the output of ntpq's saveconfig command,
which requires authentication and that a directory for such saved
configuration files has been specified in ntp.conf with "saveconfigdir".
$ man 5 ntp.conf
...
Configuration Commands
...
*pool* For type s addresses, this command mobilizes a persistent
client mode association with a number of remote servers. In
this mode the local clock can synchronized to the remote server,
but the remote server can never be synchronized to the local
clock.
...
Options:
...
*preempt* Says the association can be preempted.
...
This manual page was AutoGen=E2=80=90erated from the ntp.conf option defi=
nitions.
4.2.8p18 25 May 2024 ntp.conf(5man)
although the older:
https://www.ntp.org/documentation/4.2.8-series/confopt/#server-commands
says:
"Server Commands and Options
Last update: March 23, 2023 21:05 UTC (6ad51a76f)
...
Server Commands
...
pool
For type s addresses (only) this command mobilizes a preemptable pool
client
mode association for the DNS name specified. "
...
Server Command Options
...
preempt
Specifies the association as preemptable rather than the default
persistent.
This option is ignored with the broadcast command and is most useful with
the
manycastclient and pool commands."
Despite the timestamps you quoted, the web version is likely newer.
Autogen is run against the documentation source files with every release,
so that timestamp reflects the release date, not the last update of the documentation source files (.html in this case).
Since the overhaul of the www.ntp.org website a few years back, that documentation sadly is maintained in two places, and there's no process to ensure they stay in sync. The web version is considered the more
authoritative source, and is maintained in .md (Markdown) published only
via the converted HTML on the website. It started as a copy of the documentation from the source tarballs' /html directory, but after
conversion to Markdown and subsequent improvements, those changes have generally not been made to the HTML version distributed with the source.
I'm partly to blame because I find writing documentation tedious enough
without having to update it in two places, and I've been kept quite busy
with coding work and haven't wanted to take the time to correct
documentation that no longer reflects the reality of the code. In theory
one day I will have time to dedicate to that, but I welcome anyone who
enjoys documentation work or at least really wants accurate NTP
documentation to please volunteer to help out.
My question is why would a preemptable server, acquired using
"pool ...", continue to be polled after it has stopped
responding, i.e., the reach has gone to 0? It is a
misunderstanding on my part or is there an bug in the code?
Or a doc bug?
A doc bug and an off-by-one bug in the preemption logic.
Cheers,
Dave Hart
--00000000000017cf8706277a0a49
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon= t-family:"trebuchet ms",sans-serif"><br></div></div><br><div clas= s=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Nov 21, 202=
4 at 4:56=E2=80=AFPM Brian Inglis <<a href=3D"mailto:Brian.Inglis@system= aticsw.ab.ca">
Brian.Inglis@systematicsw.ab.ca</a>> wrote:<br></div><bloc= kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:= 1px solid rgb(204,204,204);padding-left:1ex">On 2024-11-20 14:32, Roger wro= te:<br>
> On Wed, 20 Nov 2024 19:53:00 -0000 (UTC), Brian Inglis wrote:=C2=A0</b= lockquote><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8= ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
>> Maybe add "iburst preempt" options and drop "poll 1= 1" or perhaps change to<br>
>> "maxpoll 11" or higher, unless you have very good reason=
s to require a longer<br>
>> interval than the default maximum, instead of adaptive polling bas=
ed on the error.<br>
> <br>
> Well, the documentation (confopt) tells me that the pool command<br>
> "mobilizes a preemptable pool client mode association for the<br> > DNS name specified." Why would adding "preempt" change = anything?<br>
It *may* be required and can never hurt:<br></blockquote><div><br></div><di= v><div class=3D"gmail_default" style=3D""><span style=3D"font-family:"= trebuchet ms",sans-serif">In fact it won't change anything.=C2=A0 = The only options propagated from the "</span><font face=3D"monospace">= pool</font><font face=3D"trebuchet ms, sans-serif">" directive in ntp.= conf (and thereby set on the prototype=C2=A0pool association listed with re= fid </font><font face=3D"monospace">POOL</font><font face=3D"trebuchet ms, = sans-serif"> in the peers billboard) to the resulting pool server associati= ons are "</font><font face=3D"monospace">iburst</font><font face=3D"tr= ebuchet ms, sans-serif">" and "</font><font face=3D"monospace">no= select</font><font face=3D"trebuchet ms, sans-serif">".=C2=A0 See=C2= =A0POOL_FLAG_PMASK in source code file ntp_proto.c.</font></div><br></div><= div><div class=3D"gmail_default" style=3D""><span style=3D"font-family:&quo= t;trebuchet ms",sans-serif">The preemptible option is forced on for po=
ol servers, so they are preemptible with or without that option.=C2=A0 Howe= ver, that option doesn't do much in 4.2.8 as the code intended to preem=
pt useless servers has an off-by-one error that's corrected in my test = 3792 release, so preemption only happens in the unusual case where there ar=
e more than 2 times as many pool or manycast client associations as "<= /span><font face=3D"monospace">tos maxclock</font><font face=3D"trebuchet m=
s, sans-serif">" which defaults to 10.=C2=A0 Arguably this could be fi= xed in the stable 4.2.8 branch but it would be a substantial change in beha= vior without any configuration change that might break existing setups that=
depend on the off-by-one error.</font></div><div class=3D"gmail_default" s= tyle=3D""><font face=3D"trebuchet ms, sans-serif"><br></font></div><div cla= ss=3D"gmail_default" style=3D""><font face=3D"trebuchet ms, sans-serif">As =
an aside, using "</font><font face=3D"monospace">preempt</font><font f= ace=3D"trebuchet ms, sans-serif">" on a non-pool non-manycastclient=C2= =A0association (basically, configured via "</font><font face=3D"monosp= ace">server</font><font face=3D"trebuchet ms, sans-serif">" or "<= /font><font face=3D"monospace">peer</font><font face=3D"trebuchet ms, sans-= serif">") seems quixotic to me, as it allows the association to be rem= oved but nothing is done to replace it.=C2=A0 I have a difficult time imagi= ning where that might be useful.=C2=A0 It may have been useful in the pre-2= 009 implementation of "</font><font face=3D"monospace">pool</font><fon=
t face=3D"trebuchet ms, sans-serif">" which I'm having a hard time=
remembering because I thought it was primitive and needed improvement, as =
it did all its work at startup and never changed the servers selected once =
up and running.=C2=A0 I re-implemented it to the current iteration, but did= n't catch that the preemption was suffering the aforementioned off-by-o=
ne error, or it wasn't back then.</font></div><div class=3D"gmail_defau= lt" style=3D""><font face=3D"trebuchet ms, sans-serif"><br></font></div><di=
v class=3D"gmail_default" style=3D""><font face=3D"trebuchet ms, sans-serif= ">If you're wondering why I mentioned "</font><font face=3D"monosp= ace">manycastclient</font><font face=3D"trebuchet ms, sans-serif">", i=
t shares much of the implementation with "</font><font face=3D"monospa= ce">pool</font><font face=3D"trebuchet ms, sans-serif">".=C2=A0 They u=
se different approaches to finding servers, but the rest of the code is com= mon.=C2=A0 Both are intended to be automatic server discovery schemes that = discard, or preempt, servers which haven't been useful for 10 poll inte= rvals so that another server can be solicited to replace it.</font></div></= div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px = 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
$ grep 'pool.*preempt' ~/src/time/ntp/ntp-4.2.8p18/ntpd/<a href=3D"=
http://complete.conf.in" rel=3D"noreferrer" target=3D"_blank">complete.conf= .in</a><br>
pool <a href=3D"
http://2.ubuntu.pool.ntp.org" rel=3D"noreferrer" target=3D"= _blank">2.ubuntu.pool.ntp.org</a>. iburst preempt<br></blockquote><div><br>= </div><div><div class=3D"gmail_default" style=3D""><font face=3D"monospace"= ><a href=3D"
http://complete.conf.in">complete.conf.in</a></font><span style= =3D"font-family:"trebuchet ms",sans-serif"> is part of the "= make check" tests and is not intended to suggest useful configurations= .=C2=A0 Rather it's used both to ensure every keyword in the configurat= ion file parser is covered, and to ensure a configuration can successfully = round-trip through ntpd's reading and applying the configuration and ex= porting the configuration via the </span><font face=3D"monospace">--savecon= figquit</font><font face=3D"trebuchet ms, sans-serif">=C2=A0command-line op= tion added specifically for that developer test to catch changes which brea=
k that functionality.=C2=A0 It's </font>no coincidence<font face=3D"tre= buchet ms, sans-serif">=C2=A0</font>it is<font face=3D"trebuchet ms, sans-s= erif"> ordered exactly the same as the output of </font><font face=3D"monos= pace">ntpq</font><font face=3D"trebuchet ms, sans-serif">'s </font><fon=
t face=3D"monospace">saveconfig</font><font face=3D"trebuchet ms, sans-seri=
f"> command, which requires authentication and that a directory for such sa=
ved configuration files has been specified in ntp.conf with "</font><f= ont face=3D"monospace">saveconfigdir</font><font face=3D"trebuchet ms, sans= -serif">".</font></div></div><div>=C2=A0</div><blockquote class=3D"gma= il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,2= 04,204);padding-left:1ex">
$ man 5 ntp.conf<br>
...<br>
Configuration Commands<br>
...<br>
*pool*=C2=A0 For type s addresses, this command mobilizes a persistent<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 client mode association with a number of remote=
servers. In<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 this mode the local clock can synchronized to t=
he remote server,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 but the remote server can never be synchronized=
to the local<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 clock.<br>
...<br>
Options:<br>
...<br>
*preempt*=C2=A0 =C2=A0 =C2=A0 =C2=A0Says the association can be preempted.<=
...<br>
This manual page was AutoGen=E2=80=90erated from the ntp.conf option defini= tions.<br>
4.2.8p18=C2=A0 =C2=A0 =C2=A0 =C2=A0 25 May 2024=C2=A0 =C2=A0 =C2=A0ntp.conf= (5man)<br>
although the older:<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <a href=3D"
https://www.ntp.org/documentation/4.= 2.8-series/confopt/#server-commands" rel=3D"noreferrer" target=3D"_blank">h= ttps://www.ntp.org/documentation/4.2.8-series/confopt/#server-commands</a><=
says:<br>
"Server Commands and Options<br>
Last update: March 23, 2023 21:05 UTC (6ad51a76f)<br>
...<br>
Server Commands<br>
...<br>
pool<br>
For type s addresses (only) this command mobilizes a preemptable pool clien=
t <br>
mode association for the DNS name specified. "<br>
...<br>
Server Command Options<br>
...<br>
preempt<br>
Specifies the association as preemptable rather than the default persistent=
. <br>
This option is ignored with the broadcast command and is most useful with t=
he <br>
manycastclient and pool commands."<br></blockquote><div><br></div><div= ><div class=3D"gmail_default" style=3D"font-family:"trebuchet ms"= ,sans-serif">Despite the timestamps you quoted, the web version is likely n= ewer.=C2=A0 Autogen is run against the documentation source files with ever=
y release, so that timestamp reflects the release date, not the last update=
of the documentation source files (.html in this case).</div><div class=3D= "gmail_default" style=3D"font-family:"trebuchet ms",sans-serif"><= br></div><div class=3D"gmail_default" style=3D"font-family:"trebuchet = ms",sans-serif">Since the overhaul of the <a href=3D"
http://www.ntp.or= g">www.ntp.org</a> website a few years back, that documentation sadly is ma= intained in two places, and there's no process to ensure they stay in s= ync.=C2=A0 The web version is considered the more authoritative source, and=
is maintained in .md (Markdown) published only via the converted HTML on t=
he website.=C2=A0 It started as a copy of the documentation from the source=
tarballs' /html directory, but after conversion to Markdown and subseq= uent improvements, those changes have generally not been made to the HTML v= ersion distributed with the source.=C2=A0 I'm partly to blame because I=
find writing documentation tedious enough without having to update it in t=
wo places, and I've been kept quite busy with coding work and haven'=
;t wanted to take the time to correct documentation that no longer reflects=
the reality of the code.=C2=A0 In theory one day I will have time to dedic= ate to that, but I welcome anyone who enjoys documentation work or at least=
really wants accurate=C2=A0NTP documentation to please volunteer to help o= ut.</div></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"= margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-lef= t:1ex">
> My question is why would a preemptable server, acquired using<br>
> "pool ...", continue to be polled after it has stopped<br>
> responding, i.e., the reach has gone to 0? It is a<br>
> misunderstanding on my part or is there an bug in the code?<br>
Or a doc bug?<br></blockquote><div><br></div><div><div class=3D"gmail_defau= lt" style=3D"font-family:"trebuchet ms",sans-serif">A doc bug and=
an off-by-one bug in the preemption logic.</div></div><div class=3D"gmail_= default" style=3D"font-family:"trebuchet ms",sans-serif"><br></di= v><div class=3D"gmail_default" style=3D"font-family:"trebuchet ms"= ;,sans-serif">Cheers,</div><div class=3D"gmail_default" style=3D"font-famil= y:"trebuchet ms",sans-serif">Dave Hart</div></div></div>
--00000000000017cf8706277a0a49--
--- Synchronet 3.21d-Linux NewsLink 1.2