You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by John Chia <jo...@starnix.com> on 2001/11/24 00:43:18 UTC

mod_perl segfaulting (Redhat 7.2, DSO, Apache 1.3.20)

Hi,

I have a very annoying problem with mod_perl segfaulting.  It must be
some perl code, but I cannot isolate where.  Here are the symptoms, all
running on 7.2:

1) does not happen with apache/mod_perl compiled and linked on RedHat 6.2
2) does not happen with apache/mod_perl statically linked on Redhat 7.2
3) does happen with apache from 6.2 and mod_perl (re)linked on 7.2

I don't really want to go static, plus I'm a good guinea pig for this
sort of thing!  Stack traces...

** gdb 'where' after segfaulting:

#0  __pthread_mutex_lock (mutex=0x67617765) at mutex.c:99
#1  0x401b0974 in __libc_free (mem=0x40515b18) at malloc.c:3152
#2  0x404bdb08 in Perl_sv_clear () from /usr/lib/apache/libperl.so
#3  0x404bdd3f in Perl_sv_free () from /usr/lib/apache/libperl.so
#4  0x404b7bf4 in S_visit () from /usr/lib/apache/libperl.so
#5  0x404b7c87 in Perl_sv_clean_all () from /usr/lib/apache/libperl.so
#6  0x4046f08e in perl_destruct () from /usr/lib/apache/libperl.so
#7  0x4044ee2b in perl_shutdown () from /usr/lib/apache/libperl.so
#8  0x4044f2a5 in mp_dso_unload () from /usr/lib/apache/libperl.so
#9  0x080525f9 in ap_run_cleanup () at eval.c:41
#10 0x080510cb in ap_clear_pool () at eval.c:41
#11 0x08060220 in ap_child_terminate () at eval.c:41
#12 0x08060c03 in main () at eval.c:41
#13 0x40150306 in __libc_start_main (main=0x8060780 <main>, argc=2, 
    ubp_av=0xbffffb54, init=0x804fb20 <_init>, fini=0x8089450 <_fini>, 
    rtld_fini=0x4000d2cc <_dl_fini>, stack_end=0xbffffb4c)
    at ../sysdeps/generic/libc-start.c:129

** strace is not at all helpful..  reads mime.types, opens access_log
and does some rt_sigprocmask stuff then SIGSEGV.

** Interactive debugger via Apache::DB .. (sorry bout the mess)

DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:349):
349:        return unless defined &DBI::trace_msg; # return unless
bootstrap'd ok
DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:350):
350:        local ($!,$?);
DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:351):
351:        DBI->trace_msg("    -- DBI::END\n", 2);
DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:353):
353:        $DBI::PERL_ENDING = $DBI::PERL_ENDING = 1;  # avoid typo
warning
DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:354):
354:        DBI->disconnect_all() if %DBI::installed_drh;
AppConfig::State::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig/State.pm:449):
449:        my $self = shift;
AppConfig::State::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig/State.pm:450):
450:        my ($variable, $attrib);
AppConfig::State::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig/State.pm:454):
454:        ($variable = $AUTOLOAD) =~ s/.*:://;
AppConfig::State::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig/State.pm:457):
457:        $variable eq 'DESTROY' && return;
AppConfig::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig.pm:206):
206:        my $self = shift;
AppConfig::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig.pm:207):
207:        my $method;
AppConfig::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig.pm:211):
211:        ($method = $AUTOLOAD) =~ s/.*:://;
AppConfig::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig.pm:214):
214:        $method eq 'DESTROY' && return;
Segmentation fault

** Semi-complete module list:
perl-HTML-Table-1.12a-3mtl
perl-Log-Agent-0.2.8-3mtl
perl-MLDBM-2.00-7mtl
perl-URI-1.17-5mtl
perl-Storable-1.0.13-3mtl
perl-Filesys-Statvfs_Df-0.67-4mtl
perl-Proc-ProcessTable-0.33-4mtl
perl-IO-Interface-0.97-6mtl
perl-DBD-Pg-1.01-5mtl
perl-libnet-1.0704-8mtl
perl-Apache-GTopLimit-0.01-3mtl
perl-Crypt-SSLeay-0.31-5mtl
perl-Net-IMAP-Simple-0.93-4mtl
perl-App-Config-1.09-5mtl
perl-FreezeThaw-0.41-6mtl
perl-GTop-0.10-4mtl
perl-POE-0.17-4mtl
perl-Authen-Smb-0.91-3mtl
perl-Convert-ASN1-0.07-1
perl-IMAP-Admin-1.5.1-3mtl
perl-Net-SNMP-3.5-1
perl-HTML-Mason-1.04-6mtl
perl-GDGraph-1.33-6mtl
perl-XML-Writer-0.4-0
perl-Time-HiRes-01.20-7mtl
perl-Archive-Tar-0.22-6mtl
perl-XML-Parser-2.30-7
perl-Adaptor-0.2-1
perl-GD-1.33-9mtl
perl-Apache-DB-0.06-1mtl
perl-ldap-0.25-5mtl
perl-Params-Validate-0.07-4mtl
perl-GDTextUtil-0.80-6mtl
perl-HTML-Parser-3.25-5mtl
perl-Net-DNS-0.12-6mtl
perl-Net-Printer-0.20-1
perl-MIME-Base64-2.12-7mtl
perl-Net-Finger-1.05-5mtl
perl-MLM-0.1-1
perl-Sys-CpuLoad-0.01-7mtl
perl-Digest-MD5-2.13-1
perl-libapreq-0.33-4mtl
perl-Apache-Session-1.54-4mtl
perl-5.6.1-3mtl
perl-XML-Simple-1.05-1mtl
perl-NNTPClient-0.37-6mtl
perl-DBI-1.20-5mtl
perl-Compress-Zlib-1.14-5mtl
perl-libwww-perl-5.60-9mtl
perl-Authen-Challenge-Basic-0.1-1
perl-AppConfig-1.52-7mtl

Anything else I can provide?  TIA!

-- 
john chia <jo...@starnix.com>                                  starnix inc.
tollfree: 1-87-pro-linux                        thornhill, ontario, canada
http://www.starnix.com              professional linux services & products

Re: mod_perl segfaulting (Redhat 7.2, DSO, Apache 1.3.20)

Posted by "Matthew H. Gerlach" <mg...@lightsurf.com>.
I noticed you list XML::Simple.  It is a favorite module of mine, but it uses
XML::Parser which uses the expat XML parser.  It is seems that mod_perl has problems
with XML::Parser.  This problem is supposed to be fixed in Apache 1.3.22, but I still
had problems with strange segfaults and munched scalers when using XML::Parser.  I
recommend switching XML parsers to one that doesn't use expat.  I had good luck using
XML::LibXML, especially after making a Simple API :)

Matthew Gerlach




John Chia wrote:

> Hi,
>
> I have a very annoying problem with mod_perl segfaulting.  It must be
> some perl code, but I cannot isolate where.  Here are the symptoms, all
> running on 7.2:
>
> 1) does not happen with apache/mod_perl compiled and linked on RedHat 6.2
> 2) does not happen with apache/mod_perl statically linked on Redhat 7.2
> 3) does happen with apache from 6.2 and mod_perl (re)linked on 7.2
>
> I don't really want to go static, plus I'm a good guinea pig for this
> sort of thing!  Stack traces...
>
> ** gdb 'where' after segfaulting:
>
> #0  __pthread_mutex_lock (mutex=0x67617765) at mutex.c:99
> #1  0x401b0974 in __libc_free (mem=0x40515b18) at malloc.c:3152
> #2  0x404bdb08 in Perl_sv_clear () from /usr/lib/apache/libperl.so
> #3  0x404bdd3f in Perl_sv_free () from /usr/lib/apache/libperl.so
> #4  0x404b7bf4 in S_visit () from /usr/lib/apache/libperl.so
> #5  0x404b7c87 in Perl_sv_clean_all () from /usr/lib/apache/libperl.so
> #6  0x4046f08e in perl_destruct () from /usr/lib/apache/libperl.so
> #7  0x4044ee2b in perl_shutdown () from /usr/lib/apache/libperl.so
> #8  0x4044f2a5 in mp_dso_unload () from /usr/lib/apache/libperl.so
> #9  0x080525f9 in ap_run_cleanup () at eval.c:41
> #10 0x080510cb in ap_clear_pool () at eval.c:41
> #11 0x08060220 in ap_child_terminate () at eval.c:41
> #12 0x08060c03 in main () at eval.c:41
> #13 0x40150306 in __libc_start_main (main=0x8060780 <main>, argc=2,
>     ubp_av=0xbffffb54, init=0x804fb20 <_init>, fini=0x8089450 <_fini>,
>     rtld_fini=0x4000d2cc <_dl_fini>, stack_end=0xbffffb4c)
>     at ../sysdeps/generic/libc-start.c:129
>
> ** strace is not at all helpful..  reads mime.types, opens access_log
> and does some rt_sigprocmask stuff then SIGSEGV.
>
> ** Interactive debugger via Apache::DB .. (sorry bout the mess)
>
> DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:349):
> 349:        return unless defined &DBI::trace_msg; # return unless
> bootstrap'd ok
> DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:350):
> 350:        local ($!,$?);
> DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:351):
> 351:        DBI->trace_msg("    -- DBI::END\n", 2);
> DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:353):
> 353:        $DBI::PERL_ENDING = $DBI::PERL_ENDING = 1;  # avoid typo
> warning
> DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:354):
> 354:        DBI->disconnect_all() if %DBI::installed_drh;
> AppConfig::State::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig/State.pm:449):
> 449:        my $self = shift;
> AppConfig::State::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig/State.pm:450):
> 450:        my ($variable, $attrib);
> AppConfig::State::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig/State.pm:454):
> 454:        ($variable = $AUTOLOAD) =~ s/.*:://;
> AppConfig::State::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig/State.pm:457):
> 457:        $variable eq 'DESTROY' && return;
> AppConfig::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig.pm:206):
> 206:        my $self = shift;
> AppConfig::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig.pm:207):
> 207:        my $method;
> AppConfig::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig.pm:211):
> 211:        ($method = $AUTOLOAD) =~ s/.*:://;
> AppConfig::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig.pm:214):
> 214:        $method eq 'DESTROY' && return;
> Segmentation fault
>
> ** Semi-complete module list:
> perl-HTML-Table-1.12a-3mtl
> perl-Log-Agent-0.2.8-3mtl
> perl-MLDBM-2.00-7mtl
> perl-URI-1.17-5mtl
> perl-Storable-1.0.13-3mtl
> perl-Filesys-Statvfs_Df-0.67-4mtl
> perl-Proc-ProcessTable-0.33-4mtl
> perl-IO-Interface-0.97-6mtl
> perl-DBD-Pg-1.01-5mtl
> perl-libnet-1.0704-8mtl
> perl-Apache-GTopLimit-0.01-3mtl
> perl-Crypt-SSLeay-0.31-5mtl
> perl-Net-IMAP-Simple-0.93-4mtl
> perl-App-Config-1.09-5mtl
> perl-FreezeThaw-0.41-6mtl
> perl-GTop-0.10-4mtl
> perl-POE-0.17-4mtl
> perl-Authen-Smb-0.91-3mtl
> perl-Convert-ASN1-0.07-1
> perl-IMAP-Admin-1.5.1-3mtl
> perl-Net-SNMP-3.5-1
> perl-HTML-Mason-1.04-6mtl
> perl-GDGraph-1.33-6mtl
> perl-XML-Writer-0.4-0
> perl-Time-HiRes-01.20-7mtl
> perl-Archive-Tar-0.22-6mtl
> perl-XML-Parser-2.30-7
> perl-Adaptor-0.2-1
> perl-GD-1.33-9mtl
> perl-Apache-DB-0.06-1mtl
> perl-ldap-0.25-5mtl
> perl-Params-Validate-0.07-4mtl
> perl-GDTextUtil-0.80-6mtl
> perl-HTML-Parser-3.25-5mtl
> perl-Net-DNS-0.12-6mtl
> perl-Net-Printer-0.20-1
> perl-MIME-Base64-2.12-7mtl
> perl-Net-Finger-1.05-5mtl
> perl-MLM-0.1-1
> perl-Sys-CpuLoad-0.01-7mtl
> perl-Digest-MD5-2.13-1
> perl-libapreq-0.33-4mtl
> perl-Apache-Session-1.54-4mtl
> perl-5.6.1-3mtl
> perl-XML-Simple-1.05-1mtl
> perl-NNTPClient-0.37-6mtl
> perl-DBI-1.20-5mtl
> perl-Compress-Zlib-1.14-5mtl
> perl-libwww-perl-5.60-9mtl
> perl-Authen-Challenge-Basic-0.1-1
> perl-AppConfig-1.52-7mtl
>
> Anything else I can provide?  TIA!
>
> --
> john chia <jo...@starnix.com>                                  starnix inc.
> tollfree: 1-87-pro-linux                        thornhill, ontario, canada
> http://www.starnix.com              professional linux services & products


Re: mod_perl segfaulting (Redhat 7.2, DSO, Apache 1.3.20)

Posted by John Chia <jo...@starnix.com>.
On 26 November 2001 23:41 (+0000), Ged Haywood wrote:
> Did you compile Perl yourself?

Yep.

-- 
john chia <jo...@starnix.com>                                  starnix inc.
tollfree: 1-87-pro-linux                        thornhill, ontario, canada
http://www.starnix.com              professional linux services & products

Re: mod_perl segfaulting (Redhat 7.2, DSO, Apache 1.3.20)

Posted by Ged Haywood <ge...@www2.jubileegroup.co.uk>.
Hi there,

On Mon, 26 Nov 2001, John Chia wrote:

> Still segfaulting.  Same place.
[snip]
> Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
[snip]
>   Compiler:
[snip]
>   gccversion='2.96 20000731 (Red Hat Linux 7.12.96-98)',

Did you compile Perl yourself?

73,
Ged.



Re: mod_perl segfaulting (Redhat 7.2, DSO, Apache 1.3.20)

Posted by John Chia <jo...@starnix.com>.
Hi.

On 24 November 2001 12:35 (+0800), Stas Bekman wrote:
> Check this out:
> http://perl.apache.org/guide/install.html#When_DSO_can_be_Used

Nope.  Still segfaulting.  Same place.

> yes, the output of perl -V, the args used to build mod_perl (grab the 
> src.rpm, rpm -i and look at the spec file. But first see if the above 
> URL solves your problem.

** perl -V
Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
    osname=linux, osvers=2.4.7-10, archname=i386-linux
    uname='linux europa.starnix.com 2.4.7-10 #1 thu sep 6 17:27:27 edt
2001 i686 unknown '
    config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dcc=gcc
-Dcccdlflags=-fPIC -Dinstallprefix=/usr -Dprefix=/usr
-Darchname=i386-linux -Dd_dosuid -Dd_semctl_semun -Di_db -Di_ndbm
-Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Uuselargefiles
-Ubincompat5005'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include',
    optimize='-O2 -march=i386 -mcpu=i686',
    cppflags='-fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.1
2.96-98)', 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=4
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lc -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
    libc=/lib/libc-2.2.4.so, 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): 
  Compile-time options:
  Built under linux
  Compiled at Nov 25 2001 12:57:07
  @INC:
    /usr/lib/perl5/5.6.1/i386-linux
    /usr/lib/perl5/5.6.1
    /usr/lib/perl5/site_perl/5.6.1/i386-linux
    /usr/lib/perl5/site_perl/5.6.1
    /usr/lib/perl5/site_perl/5.6.0/i386-linux
    /usr/lib/perl5/site_perl/5.6.0
    /usr/lib/perl5/site_perl/5.005/i386-linux
    /usr/lib/perl5/site_perl/5.005
    /usr/lib/perl5/site_perl
    .

** mod_perl build:
** RPM_OPT_FLAGS="-O2 -march=i386 -mcpu=i686"
CFLAGS="$RPM_OPT_FLAGS" \
    perl Makefile.PL USE_APXS=1 \
                     WITH_APXS=/usr/sbin/apxs \
                     EVERYTHING=1 \
                     CCFLAGS="$RPM_OPT_FLAGS -fPIC"
make

** usemymalloc/bincompat
[root@h241 RPMS]# perl -V:usemymalloc
usemymalloc='n';
[root@h241 RPMS]# perl -V:bincompat5005
bincompat5005='undef';

** i386 modules
perl-Array-RefElem-0.02-13mtl.i386.rpm
perl-Authen-Smb-0.91-7mtl.i386.rpm
perl-Compress-Zlib-1.14-9mtl.i386.rpm
perl-Crypt-SSLeay-0.31-8mtl.i386.rpm
perl-DBI-1.20-8mtl.i386.rpm
perl-Filesys-Statvfs_Df-0.67-7mtl.i386.rpm
perl-Filter-1.25-5mtl.i386.rpm
perl-GD-1.33-11mtl.i386.rpm
perl-GTop-0.10-6mtl.i386.rpm
perl-HTML-Parser-3.25-8mtl.i386.rpm
perl-IO-Interface-0.97-8mtl.i386.rpm
perl-libapreq-0.33-13mtl.i386.rpm
perl-MIME-Base64-2.12-9mtl.i386.rpm
perl-Newt-1.08-6mtl.i386.rpm
perl-Storable-1.0.13-5mtl.i386.rpm
perl-Time-HiRes-01.20-9mtl.i386.rpm

Thanks!

-- 
john chia <jo...@starnix.com>                                  starnix inc.
tollfree: 1-87-pro-linux                        thornhill, ontario, canada
http://www.starnix.com              professional linux services & products

Re: mod_perl segfaulting (Redhat 7.2, DSO, Apache 1.3.20)

Posted by Stas Bekman <st...@stason.org>.
John Chia wrote:

> Hi,
> 
> I have a very annoying problem with mod_perl segfaulting.  It must be
> some perl code, but I cannot isolate where.  


Check this out:
http://perl.apache.org/guide/install.html#When_DSO_can_be_Used


> Anything else I can provide?  TIA!


yes, the output of perl -V, the args used to build mod_perl (grab the 
src.rpm, rpm -i and look at the spec file. But first see if the above 
URL solves your problem.

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/