Bug 4657 - memory leak in gethostbyname() when (not) using NIS+
Summary: memory leak in gethostbyname() when (not) using NIS+
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 6.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Cristian Gafton
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-08-23 02:45 UTC by antonyn
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 1999-08-23 14:31:00 UTC
Embargoed:


Attachments (Terms of Use)

Description antonyn 1999-08-23 02:45:04 UTC
Hello,

I am running RH6.0 + updates on an x86 machine.  This box is
networked and uses NIS to sync accounts across our network.

The problem arises when code like the following is run on a
RH6 machine with the default NIS installation:

#include <stdio.h>
#include <netdb.h>
int main() {
   while (1) {
      struct hostent* pHostEnt = NULL ;
      pHostEnt = gethostbyname("www.redhat.com");
   }
  return 0 ;
}

Note that using gethostbyname_r has the same problem (I did
a search on deja.com, and Theodore Tso mentioned that using
the standard gethostbyname is prone to memory leaks.)

Running this program and watching it in top will show that
the process will continually eat memory until it severely
bogs down the machine.  The problem is glibc-related, but it
is actaully triggered with RH's default NIS setup.  The
"hosts:" entry in /etc/nsswitch.conf has 'nisplus' listed
before 'dns' - I'm guessing the leak starts here, as
switching the order (ie, having 'dns' listed before
'nisplus' on a network setup that queries a valid DNS
server) will fix the problem.

--Ant

Comment 1 antonyn 1999-08-23 02:53:59 UTC
Hello, I just found this URL on deja.com which sheds more light.
Perhaps it's time for a new glibc RPM release?

http://x46.deja.com/getdoc.xp?server=x46&AN=479412353&CONTEXT=935376493.1108344895&hitnum=2

Comment 2 antonyn 1999-08-23 02:55:59 UTC
One last note - my friend runs the latest Mandrake which includes this
version of glibc; he's a huge Mandrake advocate.  We can't have RH be
behind Mandrake in bugfixes now, can we? ;)

Comment 3 Jeff Johnson 1999-08-23 14:31:59 UTC
Memory leaks in NIS code are fixed in the Raw Hide glibc.


Note You need to log in before you can comment on or make changes to this bug.