You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Beau E. Cox" <be...@beaucox.com> on 2004/02/02 22:01:19 UTC
[mp2] Am I leaking memory?
-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:
I've got my Mason w/mod_perl2 and libapreq2 system
up and running OK, but...
Using a simple script that totals ALL httpd processes' memory
usage (from /proc/pid/status) I get this before any
requests into the server:
VmData VmExe VmLck VmLib VmRSS VmSize VmStk
4297576 32248 0 524944 1479132 4904200 2784
4297576 32248 0 524944 1479132 4904200 2784
...
And this after about 50,000 hits to Mason-enabled pages:
VmData VmExe VmLck VmLib VmRSS VmSize VmStk
4605240 32248 0 538272 1801692 5226200 2784
4605240 32248 0 538272 1801692 5226200 2784
Note the increase to VmSize.
The only place in my Mason changes I can see anything funny is:
# This gets the proper request object all in one fell swoop. We
# don't want to copy it because if we do something like assign an
# Apache::Request object to a variable currently containing a
# plain Apache object, we leak memory. This means we'd have to
# use multiple variables to avoid this, which is annoying.
my $r =
$r_sub->( $self->args_method eq 'mod_perl' ?
Apache::Request->new( $_[0] ) :
$_[0]
);
I changed:
Apache::Request->instance( $_[0] ) :
to:
Apache::Request->new( $_[0] ) :
Is that causing trouble? Is that the correct port for the
no-longer-with-us 'instance'? Or am I needlessly
paranoid?
Aloha => Beau;
2. Used Components and their Configuration:
*** mod_perl version 1.9913
*** using lib/Apache/BuildConfig.pm
*** Makefile.PL options:
MP_APXS => /usr/apache2/sbin/apxs
MP_COMPAT_1X =>
MP_GENERATE_XS => 1
MP_LIBNAME => mod_perl
MP_USE_DSO => 1
MP_USE_STATIC => 1
*** /usr/apache2/sbin/httpd -V
Server version: Apache/2.0.48
Server built: Jan 26 2004 06:20:30
Server's Module Magic Number: 20020903:4
Architecture: 32-bit
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/worker"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D HTTPD_ROOT="/usr/apache2"
-D SUEXEC_BIN="/usr/apache2/bin/suexec"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="/etc/httpd/mime.types"
-D SERVER_CONFIG_FILE="/etc/httpd/httpd.conf"
*** /usr/bin/perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 3) configuration:
Platform:
osname=linux, osvers=2.4.24, archname=i686-linux-thread-multi
uname='linux cathy.beaucox.com 2.4.24 #1 thu jan 22 20:44:13 hst 2004 i686
unknown unknown gnulinux '
config_args='-Dprefix=/usr -Dusethreads'
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=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
optimize='-O3',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='3.3.2', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.3.2'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT
Built under linux
Compiled at Jan 31 2004 21:52:34
%ENV:
PERL_LWP_USE_HTTP_10="1"
@INC:
/usr/lib/perl5/5.8.3/i686-linux-thread-multi
/usr/lib/perl5/5.8.3
/usr/lib/perl5/site_perl/5.8.3/i686-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.3
/usr/lib/perl5/site_perl
.
*** Packages of interest status:
Apache::Request: 2.02-dev
CGI : 3.04
LWP : 5.76
mod_perl : 1.9913
3. This is the core dump trace: (if you get a core dump):
[CORE TRACE COMES HERE]
This report was generated by t/REPORT on Mon Feb 2 20:44:11 2004 GMT.
-------------8<---------- End Bug Report --------------8<----------
Note: Complete the rest of the details and post this bug report to
dev <at> perl.apache.org. To subscribe to the list send an empty
email to dev-subscribe@perl.apache.org.
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2] Am I leaking memory?
Posted by Stas Bekman <st...@stason.org>.
Beau E. Cox wrote:
> -------------8<---------- Start Bug Report ------------8<----------
> 1. Problem Description:
>
> I've got my Mason w/mod_perl2 and libapreq2 system
> up and running OK, but...
>
> Using a simple script that totals ALL httpd processes' memory
> usage (from /proc/pid/status) I get this before any
> requests into the server:
>
> VmData VmExe VmLck VmLib VmRSS VmSize VmStk
> 4297576 32248 0 524944 1479132 4904200 2784
> 4297576 32248 0 524944 1479132 4904200 2784
> ...
>
> And this after about 50,000 hits to Mason-enabled pages:
>
> VmData VmExe VmLck VmLib VmRSS VmSize VmStk
> 4605240 32248 0 538272 1801692 5226200 2784
> 4605240 32248 0 538272 1801692 5226200 2784
>
> Note the increase to VmSize.
Also if you have libgtop, you can use a more flexible way to detect leaks. See
http://cvs.apache.org/viewcvs.cgi/modperl-2.0/t/conf/modperl_extra.pl?r1=1.39&r2=1.40&diff_format=h
You can braket your code sections and see which ones add more memory requirements.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2] Am I leaking memory?
Posted by Joe Schaefer <jo...@sunstarsys.com>.
"Beau E. Cox" <be...@beaucox.com> writes:
[...]
> The only place in my Mason changes I can see anything funny is:
>
> # This gets the proper request object all in one fell swoop. We
> # don't want to copy it because if we do something like assign an
> # Apache::Request object to a variable currently containing a
> # plain Apache object, we leak memory. This means we'd have to
> # use multiple variables to avoid this, which is annoying.
> my $r =
> $r_sub->( $self->args_method eq 'mod_perl' ?
> Apache::Request->new( $_[0] ) :
> $_[0]
> );
>
> I changed:
> Apache::Request->instance( $_[0] ) :
> to:
> Apache::Request->new( $_[0] ) :
>
> Is that causing trouble?
No, your change is fine. AFAICT that comment pertains to an esoteric
problem with object cleanup in libapreq/mp1, but the bug doesn't
seem to be carried over into mp2/apreq2 (the apreq2 test suite has
a test for it).
--
Joe Schaefer
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html