You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Harry Danilevsky <ha...@gmail.com> on 2009/11/30 22:44:47 UTC
[PATCH] Apache2::SizeLimit aborts when smaps is not available
1. Problem Description:
Apache2::SizeLimit aborts when smaps facility is unavailable. Here's the
error from the error log:
Linux::Smaps: Cannot open /proc/9700/smaps: No such file or directory
BEGIN failed--compilation aborted at
/data/wre/prereqs/lib/perl5/site_perl/5.10.0/i686-linux/Apache2/SizeLimit.pm
line 98
This installation is part of WebGUI CMS (hence the path, starting with
/data/wre),
but there's nothing specific to WebGUI here - it's just a plain mod_perl
file tree.
The error is not caused by insufficient read permissions - there are
simply no smaps files in /proc/xxx.
Apache2::SizeLimit documentation mentions two possible solutions:
1. Installing an OS patch with smaps support (which may or may not be an
option)
2. Setting $Apache2::SizeLimit::USE_SMAPS to 0 before the first check.
This doesn't
help in this particular case, because the error is generated within
the BEGIN block;
besides, the chunk of code which produces this error, pays no
attention to $USE_SMAPS
I believe the error is caused simply by placing the wrong (or rather
insufficient) statement inside eval() :
if ( eval { require Linux::Smaps } and Linux::Smaps->new($$) ) {
...
}
Linux::Smaps module is present, and obviously returns 1, but
Linux::Smaps->new throws an error
which is not being caught by eval.
I propose the following trivial patch:
--------------------------8<--------------------
*** ./SizeLimit.pm 2009-11-30 09:13:16.000000000 -0600
--- /tmp/SizeLimit.pm.orig 2009-11-30 09:24:04.000000000 -0600
***************
*** 58,64 ****
}
elsif (LINUX) {
! if ( eval { require Linux::Smaps and Linux::Smaps->new($$) } ) {
$HOW_BIG_IS_IT = \&linux_smaps_size_check_first_time;
}
else {
--- 58,64 ----
}
elsif (LINUX) {
! if ( eval { require Linux::Smaps } and Linux::Smaps->new($$) ) {
$HOW_BIG_IS_IT = \&linux_smaps_size_check_first_time;
}
else {
--------------------------8<--------------------
-- Harry Danilevsky
harry.danilevsky@gmail.com
2. Used Components and their Configuration:
*** mod_perl version 2.000004
*** using
/data/wre/prereqs/lib/perl5/site_perl/5.10.0/i686-linux/Apache2/BuildConfig.pm
*** Makefile.PL options:
MP_APR_LIB => aprext
MP_APXS => /data/wre/prereqs/bin/apxs
MP_COMPAT_1X => 1
MP_GENERATE_XS => 1
MP_LIBNAME => mod_perl
MP_USE_DSO => 1
*** The httpd binary was not found
*** (apr|apu)-config linking info
-L/data/wre/prereqs/lib -laprutil-1 -lexpat
-L/data/wre/prereqs/lib -lapr-1 -lrt -lcrypt -lpthread -ldl
*** /data/wre/prereqs/bin/perl -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=linux, osvers=2.4.21-51.el, archname=i686-linux
uname='linux centos3 2.4.21-51.el #1 thu aug 16 17:03:59 edt 2007 i686
i686 i386 gnulinux '
config_args='-Dprefix=/data/wre/prereqs -des'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-fno-strict-aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='3.2.3 20030502 (Red Hat Linux 3.2.3-59)',
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 -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -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='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
USE_LARGE_FILES USE_PERLIO
Built under linux
Compiled at May 27 2009 20:31:04
%ENV:
PERL_LWP_USE_HTTP_10="1"
@INC:
/data/wre/prereqs/lib/perl5/5.10.0/i686-linux
/data/wre/prereqs/lib/perl5/5.10.0
/data/wre/prereqs/lib/perl5/site_perl/5.10.0/i686-linux
/data/wre/prereqs/lib/perl5/site_perl/5.10.0
.
*** Packages of interest status:
Apache2 : -
Apache2::Request : 2.08
CGI : 3.42
ExtUtils::MakeMaker: 6.48
LWP : 5.824
mod_perl : -
mod_perl2 : 2.000004
3. This is the core dump trace: (if you get a core dump):
This report was generated by bin/mp2bug on Mon Nov 30 17:25:35 2009 GMT.