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

Danny Mayer mayer at gis.net
Thu Feb 10 03:55:37 UTC 2005


At 02:26 PM 2/9/2005, cipo wrote:
>This patch works fine for me. It is better than the &C1->&C0 patch. In the 
>case of the &C1->&C0, when the modem is switched off, the well known "too 
>many recvbufs allocated (40)" appears (e.g. reading 0 bytes). In the case 
>of this CLOCAL patch, the current transfer is aborted, but when modem is 
>powered on again, everything continues as it should.
>Thanks for the idea,
>-cipo

cipo,

The quick fix is to change the following lines in ntpd/ntp_io.c in 
input_handler():
         rb->recv_length =
             read(fd, (char *)&rb->recv_space, (unsigned)i);

         if (rb->recv_length == -1)
         {
                 netsyslog(LOG_ERR, "clock read fd %d: %m", fd);
                 freerecvbuf(rb);
                 goto select_again;
         }
to:

         rb->recv_length =
             read(fd, (char *)&rb->recv_space, (unsigned)i);

         if (rb->recv_length <= 0 || errno != 0)
         {
                 netsyslog(LOG_ERR, "clock read fd %d: %m", fd);
                 freerecvbuf(rb);
                 goto select_again;
         }

This should take care of the problem. I will put a better fix into the sources
over the next few days.

Danny




More information about the questions mailing list