[help]strange problem about gethostbyname/getaddrinfo

David DeSimone fox at verio.net
Tue Dec 9 23:58:41 PST 2008

<stutiredboy at gmail.com> wrote:
> The problem is we found when the server porcess open 1000+ or higher
> sockets(but we can query any legal domain in the system normally), the
> gethostbyname or getaddrinfo might fetch nothing(sometimes the query
> is ok), the gethostbyname's return error is:  errno=2,strerror=Host
> name lookup failure

It sounds like the resolver library is running into a 1024-descriptor
limit.  From select(2):

     The default size of FD_SETSIZE is currently 1024.  In order to accommo-
     date programs which might potentially use a larger number of open files
     with select(), it is possible to increase this size by having the program
     define FD_SETSIZE before the inclusion of any header which includes

Unfortunately you might have to rebuild the resolver library itself in
order for it to be able to query file descriptors larger than 1024.

David DeSimone == Network Admin == fox at verio.net
  "I don't like spinach, and I'm glad I don't, because if I
   liked it I'd eat it, and I just hate it." -- Clarence Darrow

This email message is intended for the use of the person to whom it has been sent, and may contain information that is confidential or legally protected. If you are not the intended recipient or have received this message in error, you are not authorized to copy, distribute, or otherwise use this message or its attachments. Please notify the sender immediately by return e-mail and permanently delete this message and any attachments. Verio, Inc. makes no warranty that this email is error or virus free.  Thank you.

More information about the freebsd-net mailing list