You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by ka...@suvi.kas.utu.fi on 2001/05/08 17:41:36 UTC
Segfault question and possible workaround
Hello!
Some help and ideas are once again needed...
I'm quite a newbie with mod_perl, so there may be a totally
reasonable explanation to segfaults that follow from a few reloads.
It seems to me that subrequest and/or stat do not work together as
I thought.
######
[Tue May 8 12:32:08 2001] [notice] child pid 1357 exit signal Segmentation fault (11)
######
package Apache::WorkMates::AutoIndex;
use strict;
use Apache::Constants qw(:common DIR_MAGIC_TYPE);
sub handler {
my $r = shift;
return DECLINED unless $r->content_type and $r->content_type eq DIR_MAGIC_TYPE;
$r->send_http_header('text/plain');
opendir DIR, $r->filename;
my @filelist = readdir DIR;
closedir DIR;
foreach my $file (@filelist) {
my $subr = $r->lookup_file($r->filename . '/' . $file);
my $fstat = [ stat $subr->finfo ];
}
$r->print("Kukkuu!");
return OK;
}
1;
######
A very quick check with the following seems to fix it,
but I haven't tested it that much.
foreach ... {
my $real_file = $r->filename . '/' . $file;
my $fstat = [ stat $real_file ];
}
The first code is used in Apache::AutoIndex also, because
my own autoindex owns a lot to Philippe M. Chiasson (Thanks Philippe!).
So maybe some Apache::AutoIndex users have got similar segfaults?
Now there is some information about configuration:
######
diff httpd.conf.default httpd.conf
950a951,954
>
> PerlModule Apache::WorkMates::AutoIndex
> PerlHandler Apache::WorkMates::AutoIndex
>
######
gdb /usr/local/wm5/apache/bin/httpd
(gdb) run -X -f /usr/local/wm5/apache/conf/httpd.conf
Starting program: /usr/local/wm5/apache/bin/httpd -X -f /usr/local/wm5/apache/conf/httpd.conf
Program received signal SIGSEGV, Segmentation fault.
0x8112181 in Perl_dounwind ()
(gdb) bt
#0 0x8112181 in Perl_dounwind ()
#1 0x811249c in Perl_die_where ()
#2 0x80ef440 in Perl_croak ()
#3 0x80fcb93 in Perl_sv_upgrade ()
#4 0x80ce0ad in Perl_gv_init ()
#5 0x80cf184 in Perl_gv_fetchpv ()
#6 0x8091689 in XS_Apache_finfo ()
#7 0x80fba4b in Perl_pp_entersub ()
#8 0x81277b0 in Perl_runops_standard ()
#9 0x80cb7c9 in perl_call_sv ()
#10 0x8084430 in perl_call_handler ()
#11 0x8083bc2 in perl_run_stacked_handlers ()
#12 0x8081fb0 in perl_handler ()
#13 0x809f799 in ap_invoke_handler ()
#14 0x80b40df in process_request_internal ()
#15 0x80b4146 in ap_process_request ()
#16 0x80ab086 in child_main ()
#17 0x80ab241 in make_child ()
#18 0x80ab3bc in startup_children ()
#19 0x80aba2c in standalone_main ()
#20 0x80ac25c in main ()
#21 0x2ab91dcc in __libc_start_main () from /lib/libc.so.6
(gdb)
######
Same compiler for perl, apache and mod_perl.
mod_perl-1.25
=============
$WM5DIR/perl/bin/perl Makefile.PL \
PERL_DEBUG=1 \
EVERYTHING=1 \
APACHE_SRC=../$APACHEDIR/src \
DO_HTTPD=1 \
USE_APACI=1 \
APACI_ARGS='--enable-module=rewrite,--enable-module=so'
make && make test && make install
(make test 100% successful)
apache_1.3.19
=============
./configure --prefix=$WM5DIR/apache \
--activate-module=src/modules/perl/libperl.a \
--enable-module=rewrite \
--enable-module=so \
--disable-rule=EXPAT
make
make install
perl5.005_03
============
Compiled with -Dprefix=/usr/local/wm5/perl -des -Uusrbinperl
perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
Platform:
osname=linux, osvers=2.2.19, archname=i686-linux
uname='linux saphire.kas.utu.fi 2.2.19 #1 thu apr 5 15:18:02 est 2001 i686 unknown '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-O2', gccversion=2.95.2 20000220 (Debian GNU/Linux)
cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
stdchar='char', d_stdstdio=undef, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldbm -ldb -ldl -lm -lc -lcrypt
libc=, so=so, useshrplib=false, libperl=libperl.a
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):
Built under linux
Compiled at May 8 2001 03:04:44
@INC:
/usr/local/wm5/perl/lib/5.00503/i686-linux
/usr/local/wm5/perl/lib/5.00503
/usr/local/wm5/perl/lib/site_perl/5.005/i686-linux
/usr/local/wm5/perl/lib/site_perl/5.005
.
--
Kari Nurmela,
kari.nurmela@utu.fi, (02) 333 8847 / (0400) 786 547