Dear Folks,

I am writing to ask for some clues dealing with an intolerable memory 
leak of an application that embeds Perl.

The application is Nagios 2.0b1 (http://www.Nagios.ORG), a GPL 
availability monitor (like Big Brother or Mon).

Nagios 1.2 would schedule service checks (eg of someones web frontend to 
their database), popen() a pipe to the responsible process (quite often 
a Perl program) and read the results.

Nagios 2.0 retains this service check model (I think) but adds some 
POSIX threads to handle the external command queue (for CGIs to ask for 
checks to be rescheduled etc).

1.2 + 5.005 Perl (FreeBSD 4.10 base system) leaks acceptably.

2.0b1 + 5.8.5 threaded Perl (threaded (FreeBSD 4.10/pthread 
library/FreeBSD port built with -DWITH_THREADS [from the port]) has an 
unacceptable leak rate (the SIZE of the Nagios process embedding Perl 
[shown by top] increases at about 1-2 MB/hour. At the moment I manage 
this by monitoring the size of the process with a cron job and 
restarting if its over a threshold. However, it would be nice to see 
my abuse of Perl unequivocally succeed in this application rather than 
Perl be abused instead [as well] as me).

(IRRC Nag 1.2 + threaded Perl also had the bad leak rate)

The FreeBSD 4.x Perl port does not build a threaded Perl by default, 
however it appears to function Ok.

All suggestions as to where to start dealing with this problem are 
welcome. I am not a professional developer so am unfamiliar with 
identifying and resolving leaks. 

It seems to me (since few use embedded Perl but far more use Nagios 
without it) that the fault is in either the FreeBSD Perl or the 
embedding support (the use of the Perl API hasn't changed between 1.2 
and 2.0, nor has the Perl shim that is called by Nagios).

Instrumenting the Perl shim (copied from perlembed) that determines 
whether the Perl service check program is feasable as is any amount of 
testbedding. 

Yours sincerely.

-- 
Stanley Hopcroft

IP Australia
Ph: (02) 6283 3189  Fax: (02) 6281 1353
PO Box 200 Woden  ACT 2606
http://www.ipaustralia.gov.au

tsitc> perl -V
Summary of my perl5 (revision 5 version 8 subversion 5) configuration:
  Platform:
    osname=freebsd, osvers=4.10-release-p5, 
archname=i386-freebsd-thread-multi-64int
    uname='freebsd tsitc.aipo.gov.au 4.10-release-p5 freebsd 
4.10-release-p5 #14: fri jan 7 12:49:27 est 2005 
[EMAIL PROTECTED]:usrobjusrsrcsystsitc i386 '
    config_args='-sde -Dprefix=/usr/local 
-Darchlib=/usr/local/lib/perl5/5.8.5/mach 
-Dprivlib=/usr/local/lib/perl5/5.8.5 
-Dman3dir=/usr/local/lib/perl5/5.8.5/perl/man/man3 
-Dman1dir=/usr/local/man/man1 
-Dsitearch=/usr/local/lib/perl5/site_perl/5.8.5/mach 
-Dsitelib=/usr/local/lib/perl5/site_perl/5.8.5 
-Dscriptdir=/usr/local/bin 
-Dsiteman3dir=/usr/local/lib/perl5/5.8.5/man/man3 
-Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv 
-Uinstallusrbinperl -Dcc=cc -Doptimize=-O -pipe  -Duseshrplib 
-Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.5/BSDPAN" -Ud_dosuid 
-Ui_gdbm -Dusethreads=y -Dusemymalloc=n -Duse64bitint'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.5/BSDPAN" 
-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe 
-I/usr/local/include',
    optimize='-O -pipe ',
    cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.5/BSDPAN" 
-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe 
-I/usr/local/include'
    ccversion='', gccversion='2.95.4 20020320 [FreeBSD]', 
gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long long', ivsize=8, nvtype='double', nvsize=8, 
Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-pthread -Wl,-E  -L/usr/local/lib'
    libpth=/usr/lib /usr/local/lib
    libs=-lgdbm -lm -lcrypt -lutil -lc_r
    perllibs=-lm -lcrypt -lutil -lc_r
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='  
-Wl,-R/usr/local/lib/perl5/5.8.5/mach/CORE'
    cccdlflags='-DPIC -fPIC', lddlflags='-shared  -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_64_BIT_INT 
USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
  Built under freebsd
  Compiled at Jan  7 2005 22:15:47
  @INC:
    /usr/local/lib/perl5/site_perl/5.8.5/mach
    /usr/local/lib/perl5/site_perl/5.8.5
    /usr/local/lib/perl5/site_perl
    /usr/local/lib/perl5/5.8.5/BSDPAN
    /usr/local/lib/perl5/5.8.5/mach
    /usr/local/lib/perl5/5.8.5
    .
tsitc> 

--
This message contains privileged and confidential information only 
for use by the intended recipient.  If you are not the intended 
recipient of this message, you must not disseminate, copy or use 
it in any manner.  If you have received this message in error, 
please advise the sender by reply e-mail.  Please ensure all 
e-mail attachments are scanned for viruses prior to opening or 
using.

Reply via email to