You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Phil Pennock <pd...@nl.demon.net> on 2004/07/06 14:15:24 UTC
segfault on global disable of mod_perl
-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:
If "PerlOptions -Enable" is set in global context in Apache config,
mod_perl segfaults.
I was experimenting, because of the support for cloned Perl instances
for differing vhosts, to see if the Perl handling could be enabled in only
the vhosts which explicitly required it, by disabling in global context
and explicit enabling. Apparently not. An error message and "don't be
stupid, and here's why it's stupid" is perhaps preferable to a segfault of
Apache.
Config to replicate, using Apache2 setup:
LoadModule perl_module libexec/apache2/mod_perl.so
<IfModule mod_perl.c>
PerlModule Apache2
PerlOptions -Enable
</IfModule>
This using the relevant ports installed under FreeBSD, with whatever
test framework that invokes. Removing "PerlOptions -Enable" avoids
the problem.
2. Used Components and their Configuration:
*** mod_perl version 1.9914
*** using /usr/local/lib/perl5/site_perl/5.8.4/mach/Apache2/Apache/BuildConfig.pm
*** Makefile.PL options:
MP_APXS => /usr/local/sbin/apxs
MP_COMPAT_1X => 1
MP_GENERATE_XS => 1
MP_INST_APACHE2 => 1
MP_LIBNAME => mod_perl
MP_USE_DSO => 1
MP_USE_STATIC => 1
*** /usr/local/sbin/httpd -V
Server version: Apache/2.0.49
Server built: Jun 23 2004 22:30:44
Server's Module Magic Number: 20020903:7
Architecture: 32-bit
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_FLOCK_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D HTTPD_ROOT="/usr/local"
-D SUEXEC_BIN="/usr/local/bin/suexec"
-D DEFAULT_PIDLOG="/var/run/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="/var/run/accept.lock"
-D DEFAULT_ERRORLOG="/var/log/httpd-error.log"
-D AP_TYPES_CONFIG_FILE="etc/apache2/mime.types"
-D SERVER_CONFIG_FILE="etc/apache2/httpd.conf"
*** /usr/local/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
Platform:
osname=freebsd, osvers=4.10-release, archname=i386-freebsd-64int
uname='freebsd biertje.www.nl.demon.net 4.10-release freebsd 4.10-release #0: tue may 25 22:47:12 gmt 2004 root@perseus.cse.buffalo.edu:usrobjusrsrcsysgeneric i386 '
config_args='-sde -Dprefix=/usr/local -Darchlib=/usr/local/lib/perl5/5.8.4/mach -Dprivlib=/usr/local/lib/perl5/5.8.4 -Dman3dir=/usr/local/lib/perl5/5.8.4/perl/man/man3 -Dman1dir=/usr/local/man/man1 -Duse64bitint -Dsitearch=/usr/local/lib/perl5/site_perl/5.8.4/mach -Dsitelib=/usr/local/lib/perl5/site_perl/5.8.4 -Dscriptdir=/usr/local/bin -Dsiteman3dir=/usr/local/lib/perl5/5.8.4/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv -Uinstallusrbinperl -Dcc=cc -Doptimize=-O -pipe -march=pentiumpro -Duseshrplib -Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.4/BSDPAN" -Ud_dosuid -Ui_gdbm -Dusethreads=n -Dusemymalloc=y'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=undef uselongdouble=undef
usemymalloc=y, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.4/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include',
optimize='-O -pipe -march=pentiumpro',
cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.4/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -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 ='-Wl,-E -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lm -lcrypt -lutil -lc
perllibs=-lm -lcrypt -lutil -lc
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.4/mach/CORE'
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: USE_64_BIT_INT USE_LARGE_FILES
Built under freebsd
Compiled at Jun 23 2004 22:57:31
%ENV:
PERL_LWP_USE_HTTP_10="1"
@INC:
/usr/local/lib/perl5/site_perl/5.8.4/mach
/usr/local/lib/perl5/site_perl/5.8.4
/usr/local/lib/perl5/site_perl
/usr/local/lib/perl5/5.8.4/BSDPAN
/usr/local/lib/perl5/5.8.4/mach
/usr/local/lib/perl5/5.8.4
.
3. This is the core dump trace: (if you get a core dump):
Starting Apache2 httpd (not restart/graceful, but clean):
(gdb) bt
#0 0x28434336 in Perl_sv_vcatpvfn () from /usr/local/lib/perl5/5.8.4/mach/CORE/libperl.so
#1 0x284339b5 in Perl_sv_vsetpvfn () from /usr/local/lib/perl5/5.8.4/mach/CORE/libperl.so
#2 0x284118d1 in Perl_vform () from /usr/local/lib/perl5/5.8.4/mach/CORE/libperl.so
#3 0x28411880 in Perl_form () from /usr/local/lib/perl5/5.8.4/mach/CORE/libperl.so
#4 0x283901c5 in modperl_hook_pre_config () from /usr/local/libexec/apache2/mod_perl.so
#5 0x8063b91 in ap_run_post_config ()
#6 0x80687e6 in main ()
#7 0x805cdba in _start ()
This report was generated by -e on Tue Jul 6 12:05:39 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.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: segfault on global disable of mod_perl
Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Phil Pennock wrote:
>
>> -------------8<---------- Start Bug Report ------------8<----------
>> 1. Problem Description:
>>
>> If "PerlOptions -Enable" is set in global context in Apache config,
>> mod_perl segfaults.
>>
>> I was experimenting, because of the support for cloned Perl instances
>> for differing vhosts, to see if the Perl handling could be enabled in
>> only
>> the vhosts which explicitly required it, by disabling in global context
>> and explicit enabling. Apparently not. An error message and "don't be
>> stupid, and here's why it's stupid" is perhaps preferable to a
>> segfault of
>> Apache.
>>
>> Config to replicate, using Apache2 setup:
>>
>> LoadModule perl_module libexec/apache2/mod_perl.so
>> <IfModule mod_perl.c>
>> PerlModule Apache2
>> PerlOptions -Enable
>> </IfModule>
>>
>> This using the relevant ports installed under FreeBSD, with whatever
>> test framework that invokes. Removing "PerlOptions -Enable" avoids
>> the problem.
>
>
> Thank you, Phil, for the proper bug report. It was easy to reproduce the
> problem.
>
> For now, I think to just add an assert when one tries to do that on the
> top level. This is because we do many things on the top level. It's
> possible that will be able to still disable mod_perl for the top-level,
> but may try to look at that later.
Actually it was pretty easy to add a real fix, if you try the current
cvs you should be able to say:
PerlOptions -Enable
Listen 0.0.0.0:8533
<VirtualHost _default_:8533>
PerlOptions +Enable
<Location /foo>
SetHandler modperl
PerlResponseHandler foo
</Location>
</VirtualHost>
none of the handlers will be executed at the top level, but perl will be
available. Of course I did very basic testing, so it's possible that you
will spot some other issues with it. Let us know whether the current cvs
works for you.
--
__________________________________________________________________
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: segfault on global disable of mod_perl
Posted by Stas Bekman <st...@stason.org>.
Phil Pennock wrote:
> -------------8<---------- Start Bug Report ------------8<----------
> 1. Problem Description:
>
> If "PerlOptions -Enable" is set in global context in Apache config,
> mod_perl segfaults.
>
> I was experimenting, because of the support for cloned Perl instances
> for differing vhosts, to see if the Perl handling could be enabled in only
> the vhosts which explicitly required it, by disabling in global context
> and explicit enabling. Apparently not. An error message and "don't be
> stupid, and here's why it's stupid" is perhaps preferable to a segfault of
> Apache.
>
> Config to replicate, using Apache2 setup:
>
> LoadModule perl_module libexec/apache2/mod_perl.so
> <IfModule mod_perl.c>
> PerlModule Apache2
> PerlOptions -Enable
> </IfModule>
>
> This using the relevant ports installed under FreeBSD, with whatever
> test framework that invokes. Removing "PerlOptions -Enable" avoids
> the problem.
Thank you, Phil, for the proper bug report. It was easy to reproduce the problem.
For now, I think to just add an assert when one tries to do that on the top
level. This is because we do many things on the top level. It's possible that
will be able to still disable mod_perl for the top-level, but may try to look
at that later.
Index: src/modules/perl/modperl_cmd.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
retrieving revision 1.60
diff -u -r1.60 modperl_cmd.c
--- src/modules/perl/modperl_cmd.c 16 Jun 2004 03:55:47 -0000 1.60
+++ src/modules/perl/modperl_cmd.c 7 Jul 2004 08:07:43 -0000
@@ -369,6 +369,12 @@
const char *error;
MP_TRACE_d(MP_FUNC, "arg = %s\n", arg);
+
+ /* the main server must not have mod_perl disabled (-Enable) */
+ if (strEQ(arg, "-Enable")) {
+ return "Top level 'PerlOption -Enable' is not allowed";
+ }
+
if ((error = modperl_options_set(p, opts, arg)) && !is_per_dir) {
/* maybe a per-directory option outside of a container */
if (modperl_options_set(p, dcfg->flags, arg) == NULL) {
--
__________________________________________________________________
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org