gethotbyname error continued

Jerry Feldman gaf at blu.org
Tue Jun 18 17:09:01 EDT 2002


I'm workng on the assumption that gethostbyname() is actually opening up 
the socket and not closing it. 
But, it may also be a related issue, such as the application is opening 
sockets and not closing. Calls like gethostbyname() do open sockets 
implicitly. 

But, I would look at the application. does it explicitly open a new 
connection each time and not close. 

lsof might be able to help diagnose the problem. Gethostbyname() might only 
be the symptom. 

If this is a threaded app, a thread may be opening a socket without closing 
it. Unlike a process, a thread does not automatically clean up after 
itself. 
On 18 Jun 2002 at 16:57, Patrick R. McManus wrote:

> [Jerry Feldman: Tue, Jun 18, 2002 at 04:48:45PM -0400]
> > endhostent() should take care of that. 
> > It's kind of too bad that Purify has not been ported to Linux. Purify would 
> > be able to tell you that very quickly, but ....
> 
> The sockets that take all his fd's are from his network protocol code,
> not the namelookup at all. Literally his call to socket() not an
> implicit one in the name resolution code.
> 
> 1021 was a very obvious number on linux, where the default fds per
> process is 1024. in this case that's 1021 plus stdin, stdout, stderr.
> 
> -P
> 


--
Jerry Feldman <gaf at blu.org>
Associate Director
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9




More information about the Discuss mailing list