Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Dec 2008 13:57:22 +0800
From:      "=?GB2312?B?s8LQocn6?=" <stutiredboy@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   [help]strange problem about gethostbyname/getaddrinfo
Message-ID:  <a35775750812092157i715ccb4bn542b871e1cb61fe0@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
hi,all,we have a project which must resolv some domains in the server
process
our system in FreeBSD 6.2 or 6.3, the server process may open 7000+
sockets,not fork
we have set the maxopensockets as 65536,as follows:

kern.ipc.numopensockets: 4737
kern.ipc.maxsockets: 65536
socket:          356,    65538,   4737,   6747, 64793968

and the follow is our limit info:

cputime      unlimited
filesize     unlimited
datasize     2621440 kbytes
stacksize    65536 kbytes
coredumpsize unlimited
memoryuse    unlimited
vmemoryuse   unlimited
descriptors  655000
memorylocked unlimited
maxproc      5547
sbsize       unlimited

I am sure we have set the /etc/reslov.conf correctly, I can resolve any
legal domain
use dig or gethostbyname or getaddrinfo in my another test program

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

and the getaddrinfo's return error is:
"hostname nor servname provided, or not known",    /* EAI_NONAME */

we have tried to use the tcpdump to analyse the query packets, unluckily ,
we catch nothing,
seem like that the program does not query anything(or get none dns
server,even 127.0.0.1) ,
neither using gethostbyname nor getaddrinfo,and we also try set the query
type as tcp and udp,
the same disappointment result.

The stranger thing is we have tried to run another demo process which have
open 4000+ sockets,
all work well..so the problem might not related to open too much
sockets..and we found that, even
we set the /etc/resolve.conf nothing, normally the gethostbyname/getaddrinfo
will check
127.0.0.1, and we can get the query packets

The server process's query is under a single process not multi threads

Can anyone help me analyse the error/problem, which may raise this situation
or any useful info,
thanks very much !



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a35775750812092157i715ccb4bn542b871e1cb61fe0>