Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Sep 1997 10:19:29 +0200 (SAT)
From:      Graham Wheeler <gram@cdsec.com>
To:        mike@smith.net.au (Mike Smith)
Cc:        freebsd-bugs@freebsd.org, hackers@freebsd.org
Subject:   Re: Memory leak in getservbyXXX?
Message-ID:  <199709120819.KAA19990@cdsec.com>
In-Reply-To: <199709120243.MAA00728@word.smith.net.au> from "Mike Smith" at Sep 12, 97 12:43:35 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> > 
> > We have a application-level gateway program which is occasionally freezing
> > up, in what seems to be a busy loop (if we run `top' the gateway process is
> > the most CPU-intensive, chewing up CPU cycles as fast as it can). We have
> > collected several core dumps from the gateway program when this happens. 
> 
> If you can simulate the situation locally, attaching to the running 
> process with gdb and stepping through the loop would almost certainly 
> be very instructive.

Unfortunately the problem has never occurred at our site; I am working with 
core dumps mailed to me by the client (generated by sending a SIGABRT to the
spinning process).

> > In each case, while the location in our own code varies, the stack trace
> > always ends in a call to getservbyname() or getservbyport(). These in turn
> > are calling either malloc() or free(), which in turn seem to be calling
> > fstat() (at least according to the stack backtrace).
> 
> That's fairly odd; malloc()/free() do not call fstat().   Are you using 
> the system malloc() or the GNU version?  

The system malloc, as far as I know. And I did search the source for fstat,
and didn't find it, so I agree this is odd. But that's what gdb is reporting
in the stack backtrace...

> > Is anyone aware of a problem with the implementation of the /etc/services
> > lookup routines in FreeBSD 2.2.2? I will go through the library source code
> > myself tomorrow, and compre it with FreeBSD 2.1.0, but I am hoping that this
> > problem is already known, and hopefully that a fix is available.
> 
> Not as far as I am aware; something like this would have been somewhat 
> of a showstopper I would expect.  If you have a copy of the CVS 
> repository on hand extracting the changes between 2.1 and 2.2 would be 
> very straightforward.

Yes and no - our application is doing thousands of calls to these routines
every hour, and it never terminates (some sites have been running the same
process for nearly a year without a restart or reboot). So if the problem
is a memory leak, for example, it may not show up except in situations like
ours where there are so many calls.

I'm considering prescanning the tables used once at the start and looking
up all the services once only; this is a good idea from a performance point
of view and may make the problem go away.

> Please keep us informed of your progress, and if there is anything more 
> we can do to help, please ask!

Wilco.

-- 
Dr Graham Wheeler                          E-mail: gram@cdsec.com
Citadel Data Security                      Phone:  +27(21)23-6065/6/7
Internet/Intranet Network Specialists      Mobile: +27(83)-253-9864
Firewalls/Virtual Private Networks         Fax:    +27(21)24-3656
Data Security Products                     WWW:    http://www.cdsec.com/






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