More on ntpq

Hal Murray hmurray at
Thu Oct 10 21:48:39 UTC 2019

The current mru code has a "frags" mechanism to get a batch of reply packets 
for a single request.  It defaults to MAXFRAGS which is 32.

I have one case where that doesn't work.  debug 1 shows many things like this:

sendrequest: opcode=10, associd=0, qdata=nonce=e14a197a678c2ccd0f18bb72, 
2019-10-10T20:48:29.0772529Z Fragment collection begins
2019-10-10T20:48:29.297432Z Hole in fragment sequence, 3 of 4

There is code to reduce frags but I've never seen it do anything.

"mru frags=3" is different, but I see things like this:

2019-10-10T20:59:03.491458Z Fragment collection begins
2019-10-10T20:59:03.9608045Z no overlap between prior entries and server MRU 
2019-10-10T20:59:03.960858Z --->   Restarting from the beginning, retry #1

That's retrying the second request.  The first seemed to work.

The code to increase frags does work, even when it shouldn't:
sendrequest: opcode=10, associd=0, qdata=nonce=e14a1b6c7b7821583a1b6fe9, 
2019-10-10T21:04:50.6700318Z Fragment collection begins
2019-10-10T21:04:50.8196821Z Hole in fragment sequence, 3 of 4
sendrequest: opcode=10, associd=0, qdata=nonce=e14a1b6c7b7821583a1b6fe9, 
2019-10-10T21:04:50.8198574Z Fragment collection begins
2019-10-10T21:04:51.6406655Z Hole in fragment sequence, 1 of 2
sendrequest: opcode=10, associd=0, qdata=nonce=e14a1b6c7b7821583a1b6fe9, 
2019-10-10T21:04:51.6408541Z Fragment collection begins
2019-10-10T21:04:52.596875Z Hole in fragment sequence, 1 of 2

This may explain why I wasn't seeing any output from mru when it timed out.  
It did print out everything it had - it just hadn't collected anything.


There should be a mechanism to bail if it doesn't make any progress after N 

There is also the problem of never finishing because requests are arriving and 
making new/updated slots faster than they can be retrieved.  I think we can 
fix that by looking at the time stamp in the returned slot.  (There are 2 -  
first and last.)  I'm thinking of something like bail when you get to last 
times that are past the time that the mru command started.  Maybe allow an 
extra 10 seconds.  We should be able to come up with some heuristic that works 
well enough.

These are my opinions.  I hate spam.

More information about the devel mailing list