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

David L. Mills mills at udel.edu
Tue Feb 8 04:07:25 UTC 2005


Thanks for sniffing that. There are much more competent hands than mine 
in the I/O area, so I'll let those hands shake. Meanwhle, a zero-length 
serial I/O read should never return zero bytes. As you might see in 
ntp_refclock.c, serial I/O is assembled transparently byte by byte in 
gtraw() and formatted into lines by gtlin().


cipo wrote:

> Hi,
> Without C1->C0 change in the modem initialization string (for the 
> Europian time services of course) the serial port return 0 bytes.
> In ntp_io.c/void input_handler(l_fp *cts)
> select(maxactivefd+1,...) triggered,
> ...
> rb=get_free_recv_buffer(); buffer allocated
> ...
> rb->recv_length=read(fd,...); read 0 bytes !!!
> if(rb->recv_length == -1) {
>    handled as error, buffer released.
> }
> But in the case of rb->recv_length=0, buffer remains allocated, 
> select(...) triggered again, (in ntpd.c/service_main too)  reading 0 
> bytes again, 40 times, then the message in the subject appears. If the 
> rb->recv_length=0 handled as above (buffer released, goto select_again) 
> than there is an infinite loop with 100% proc consumed. Another approach 
> is required.
> If C0 patch applied, this not happens.
> I don't now the correct solution yet.
> -cipo

More information about the questions mailing list