[ntp:questions] Re: ACTS - too many recvbufs allocated (40) (Correct the Version of ntp-dev)

mayer at gis.net mayer at gis.net
Tue Feb 15 14:04:44 UTC 2005

----- Original Message Follows -----
> On Fri, 11 Feb 2005 21:54:24 -0500, Danny Mayer <mayer at gis.net> wrote:
> > It turns out that this is in a tight double loop and never gets out.
> > I removed the two loops and things start to work again. The goto's
> > shouldn't be there at all for a select that still has fd's to check.
> > I'm still working on this.
> Without the "while (0 < (n = select(..." loop, do you run into trouble
> with non-queueing signals?  For example if two network packets arrive
> near simultaneously for the same socket, is SIGIO/SIGPOLL raised only
> once?  If so, only one would be read if you don't re-do the select.

There is a third loop that I hadn't mentioned in my message. It's not
in input_handler(), it's in ntpmain() in ntpd.c and calls
as well as processing the received packets. If a packet arrives after
the socket is processed it will be picked up on the next call. Part of
the problem with the previous code is that recvbuffs would fill up
getting processed and you'd run out of buffers, hence the error message.
We could read a socket until it's empty but then we have the problem of
running out of recvbuffs again if the server gets hit with a lot of
The select() in ntpd.c gets called each time through the loop. I'd like
get this down to just one select since two, one after the other, is not
an efficient idea. Any further changes will have to wait until I have
to take another look at it.


More information about the questions mailing list