You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ali ISIK <fe...@gmail.com> on 2005/10/20 14:48:42 UTC

[mp2] repeatable segfault at ap_get_module_config

-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:

I am building a web application with a Postgres backend using
Class::DBI.  Some scripts generate repeatable Segmentation
Faults on their second invocation.  I tried compiling everything
with cc and then compiling everything with gcc.  Still the same
segfaults.  Perl, Apache, mod_perl and the CPAN modules are
all the latest stable versions.


2. Used Components and their Configuration:

*** mod_perl version 2.000001

*** using /usr/local/lib/perl5/site_perl/5.8.7/i686-linux/Apache2/BuildConfig.pm

*** Makefile.PL options:
  MP_APR_LIB     => aprext
  MP_APXS        => /usr/local/apache2/bin/apxs
  MP_COMPAT_1X   => 1
  MP_DEBUG       => 1
  MP_GENERATE_XS => 1
  MP_LIBNAME     => mod_perl
  MP_MAINTAINER  => 1
  MP_TRACE       => 1
  MP_USE_DSO     => 1


*** The httpd binary was not found

NOTE: I don't know why this is so.  Please tell me the
kind of information that you require, beyond what follows,
and I will try to provide it.

charm:/usr/local/apache2/bin # ./httpd -v
Server version: Apache/2.0.55
Server built:   Oct 20 2005 13:54:18
charm:/usr/local/apache2/bin # ./httpd -l
Compiled in modules:
  core.c
  mod_access.c
  mod_auth.c
  mod_include.c
  mod_log_config.c
  mod_env.c
  mod_setenvif.c
  prefork.c
  http_core.c
  mod_mime.c
  mod_status.c
  mod_autoindex.c
  mod_asis.c
  mod_cgi.c
  mod_negotiation.c
  mod_dir.c
  mod_imap.c
  mod_actions.c
  mod_userdir.c
  mod_alias.c
  mod_so.c
charm:/usr/local/apache2/bin #



*** (apr|apu)-config linking info

 -L/usr/local/apache2/lib -laprutil-0 -lexpat
 -L/usr/local/apache2/lib -lapr-0 -lrt -lm -lcrypt -lnsl  -lpthread -ldl



*** /usr/local/bin/perl5.8.7 -V
Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
  Platform:
    osname=linux, osvers=2.6.11.4-20a-default, archname=i686-linux
    uname='linux charm 2.6.11.4-20a-default #1 wed mar 23 21:52:37 utc
2005 i686 i686 i386 gnulinux '
    config_args='-des -Doptimize=-g -Dusedevel -Dcc=gcc'
    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=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-DDEBUGGING -fno-strict-aliasing -pipe
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-g',
    cppflags='-DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='3.3.5 20050117 (prerelease) (SUSE
Linux)', 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='gcc', 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=, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.4'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: DEBUGGING USE_LARGE_FILES
  Built under linux
  Compiled at Oct 20 2005 13:31:14
  %ENV:
    PERL_LWP_USE_HTTP_10="1"
  @INC:
    /usr/local/lib/perl5/5.8.7/i686-linux
    /usr/local/lib/perl5/5.8.7
    /usr/local/lib/perl5/site_perl/5.8.7/i686-linux
    /usr/local/lib/perl5/site_perl/5.8.7
    /usr/local/lib/perl5/site_perl
    .

*** Packages of interest status:

Apache2            : -
Apache2::Request   : -
CGI                : 3.10
ExtUtils::MakeMaker: 6.17
LWP                : 5.803
mod_perl           : -
mod_perl2          : 2.000001


3. This is the core dump trace: (if you get a core dump):

(gdb) where
#0  ap_get_module_config (cv=0x30303320, m=0x30303320) at util_debug.c:106
#1  0x40331f30 in Perl_pp_entersub () at pp_hot.c:2888
#2  0x40314b9d in Perl_runops_debug () at dump.c:1452
#3  0x402c48fa in S_call_body (myop=0xbfffeea0, is_eval=0) at perl.c:2364
#4  0x402c4577 in Perl_call_sv (sv=0x8173398, flags=4) at perl.c:2282
#5  0x402a7303 in modperl_callback (handler=0x8130b30, p=0x825f880,
r=0x825f8b8, s=0x80bd848, args=0x8777914)
    at modperl_callback.c:100
#6  0x402a7a0e in modperl_callback_run_handlers (idx=6, type=4,
r=0x825f8b8, c=0x0, s=0x80bd848, pconf=0x0, plog=0x0, ptemp=0x0,
    run_mode=MP_HOOK_RUN_FIRST) at modperl_callback.c:261
#7  0x402a7de5 in modperl_callback_per_dir (idx=6, r=0x825f8b8,
run_mode=MP_HOOK_RUN_FIRST) at modperl_callback.c:368
#8  0x402a34ee in modperl_response_handler_run (r=0x825f8b8, finish=0)
at mod_perl.c:979
#9  0x402a379b in modperl_response_handler_cgi (r=0x825f8b8) at mod_perl.c:1074
#10 0x0807eafb in ap_run_handler (r=0x825f8b8) at config.c:152
#11 0x08081535 in ap_invoke_handler (r=0x825f8b8) at config.c:364
#12 0x0806e0df in ap_process_request (r=0x825f8b8) at http_request.c:249
#13 0x08069669 in ap_process_http_connection (c=0x8257970) at http_core.c:251
#14 0x08088acb in ap_run_process_connection (c=0x8257970) at connection.c:43
#15 0x0807dc08 in child_main (child_num_arg=<value optimized out>) at
prefork.c:610
#16 0x0807dd91 in make_child (s=<value optimized out>, slot=0) at prefork.c:704
#17 0x0807de21 in startup_children (number_to_start=5) at prefork.c:722
#18 0x0807e4ed in ap_mpm_run (_pconf=0x80b90a8, plog=0x80f1188,
s=0x80bd848) at prefork.c:941
#19 0x080836fc in main (argc=3, argv=0xbffff444) at main.c:618
(gdb) define curinfo
Type commands for definition of "curinfo".
End with a line saying just "end".
>     printf "%d:%s\n", PL_curcop->cop_line, \
     ((XPV*)(*(XPVGV*)PL_curcop->cop_filegv->sv_any)\
     ->xgv_gp->gp_sv->sv_any)->xpv_pv
>  end
(gdb) curinfo
62:(eval 26)
(gdb)


This report was generated by /usr/local/bin/mp2bug on Thu Oct 20
12:05:44 2005 GMT.

-------------8<---------- End Bug Report --------------8<----------

Re: [mp2] repeatable segfault at ap_get_module_config

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Ali ISIK wrote:
> Philippe,
> 
> Thank you for your help.  Please find the gdb
> output below.  m doesn't seem to point to
> anything.
> 
> Here is some more information that may be relevant.
> 
> (1) The segfault seems to happen *after* the http session
> is complete, perhaps during some destroy/garbage-collect
> sequence.  That is, the browser gets what it asks for.
> If you have tens of server children, the user does not
> feel that anything is amiss.
> 
> (2) When I configure the /perl/ directory to be the
> equivalent of /cgi-bin/ (ScriptAlias), all seems to
> be fine; no error messages in the log.

Makes sense, since that's not going thru mod_perl anymore.

> (3) here is the end of http.conf:
> [...]
> 
> On 10/21/05, Philippe M. Chiasson <go...@ectoplasm.org> wrote:
> 
>>Ali ISIK wrote:
>>
>>>-------------8<---------- Start Bug Report ------------8<----------
>>>1. Problem Description:
>>>
>>>I am building a web application with a Postgres backend using
>>>Class::DBI.  Some scripts generate repeatable Segmentation
>>>Faults on their second invocation.  I tried compiling everything
>>>with cc and then compiling everything with gcc.  Still the same
>>>segfaults.  Perl, Apache, mod_perl and the CPAN modules are
>>>all the latest stable versions.
>>
>>Any chance at reducing these scripts to a short example that causes
>>this bug ?
> 
> There are so many modules that you would curse at me
> if I sent you all that stuff.  I can create a tarball of the
> used modules and send that as an attachment, but
> even that would require some work, as I would like
> to reduce the info-noise as much as possible.
> Please tell me if you would like this.

Nope, I was only asking if there was a way to reduce this bug to
a single script of a few lines ;-) No tarballs please!

>>>[...]
>>>
>>>3. This is the core dump trace: (if you get a core dump):
>>>
>>>(gdb) where
>>>#0  ap_get_module_config (cv=0x30303320, m=0x30303320) at util_debug.c:106
>>>#1  0x40331f30 in Perl_pp_entersub () at pp_hot.c:2888
>>> [...]
>>>(gdb)
>>
>>Can you :
>>
>>(gdb) print *m
>>(gdb) print *cv
>>
> (gdb) run -X
> Starting program: /usr/local/apache2/bin/httpd -X
> [Thread debugging using libthread_db enabled]
> [New Thread 1076002208 (LWP 18474)]
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 1076002208 (LWP 18474)]
> ap_get_module_config (cv=0x2, m=0x2) at util_debug.c:106
> 106         return ((void **)cv)[m->module_index];
> 
> (gdb) print *m
> Cannot access memory at address 0x2
> 
> (gdb) print *cv
> $1 = <incomplete type>

That's odd, from the previous backtrace you sent, m and cv were apparently
valid. Can you try again ?

-- 
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Re: [mp2] repeatable segfault at ap_get_module_config

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Ali ISIK wrote:
> ===========================================
> LoadModule perl_module modules/mod_perl.so
> 
> <Directory "/usr/local/apache2/perl">
>         AllowOverride None
>         Order allow,deny
>         Allow from all
> </Directory>
> 
> PerlModule ModPerl::Registry
> Alias /perl/ /usr/local/apache2/perl/
> <Location /perl/>
>         SetHandler perl-script
>         PerlResponseHandler ModPerl::Registry
>         PerlOptions +ParseHeaders
>         Options +ExecCGI
> </Location>
> 
> PerlSwitches -wT
> #PerlTrace all
You could combine these Directory and Location sections.
Don't know if it will help, but its simpler :)

PerlModule ModPerl::Registry
Alias /perl/ /usr/local/apache2/perl/
<Location /perl/>
          SetHandler perl-script
          PerlResponseHandler ModPerl::Registry
          PerlOptions +ParseHeaders
          Options +ExecCGI
          AllowOverride None
          Order allow,deny
          Allow from all
</Location>


-- 
END
------------------------------------------------------------
     What doesn't kill us can only make us stronger.
                 Nothing is impossible.
				
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
   http://www.liquidityservicesinc.com
        http://www.liquidation.com
        http://www.uksurplus.com
        http://www.govliquidation.com
        http://www.gowholesale.com


Re: [mp2] repeatable segfault at ap_get_module_config

Posted by Ali ISIK <fe...@gmail.com>.
Philippe,

Thank you for your help.  Please find the gdb
output below.  m doesn't seem to point to
anything.

Here is some more information that may be relevant.

(1) The segfault seems to happen *after* the http session
is complete, perhaps during some destroy/garbage-collect
sequence.  That is, the browser gets what it asks for.
If you have tens of server children, the user does not
feel that anything is amiss.

(2) When I configure the /perl/ directory to be the
equivalent of /cgi-bin/ (ScriptAlias), all seems to
be fine; no error messages in the log.

(3) here is the end of http.conf:
===========================================
LoadModule perl_module modules/mod_perl.so

<Directory "/usr/local/apache2/perl">
        AllowOverride None
        Order allow,deny
        Allow from all
</Directory>

PerlModule ModPerl::Registry
Alias /perl/ /usr/local/apache2/perl/
<Location /perl/>
        SetHandler perl-script
        PerlResponseHandler ModPerl::Registry
        PerlOptions +ParseHeaders
        Options +ExecCGI
</Location>

PerlSwitches -wT
#PerlTrace all

CoreDumpDirectory /tmp
==========================================

On 10/21/05, Philippe M. Chiasson <go...@ectoplasm.org> wrote:
> Ali ISIK wrote:
> > -------------8<---------- Start Bug Report ------------8<----------
> > 1. Problem Description:
> >
> > I am building a web application with a Postgres backend using
> > Class::DBI.  Some scripts generate repeatable Segmentation
> > Faults on their second invocation.  I tried compiling everything
> > with cc and then compiling everything with gcc.  Still the same
> > segfaults.  Perl, Apache, mod_perl and the CPAN modules are
> > all the latest stable versions.
>
> Any chance at reducing these scripts to a short example that causes
> this bug ?
>

There are so many modules that you would curse at me
if I sent you all that stuff.  I can create a tarball of the
used modules and send that as an attachment, but
even that would require some work, as I would like
to reduce the info-noise as much as possible.
Please tell me if you would like this.

> > [...]
> >
> > 3. This is the core dump trace: (if you get a core dump):
> >
> > (gdb) where
> > #0  ap_get_module_config (cv=0x30303320, m=0x30303320) at util_debug.c:106
> > #1  0x40331f30 in Perl_pp_entersub () at pp_hot.c:2888
> > #2  0x40314b9d in Perl_runops_debug () at dump.c:1452
> > #3  0x402c48fa in S_call_body (myop=0xbfffeea0, is_eval=0) at perl.c:2364
> > #4  0x402c4577 in Perl_call_sv (sv=0x8173398, flags=4) at perl.c:2282
> > #5  0x402a7303 in modperl_callback (handler=0x8130b30, p=0x825f880,
> > r=0x825f8b8, s=0x80bd848, args=0x8777914)
> >     at modperl_callback.c:100
> > #6  0x402a7a0e in modperl_callback_run_handlers (idx=6, type=4,
> > r=0x825f8b8, c=0x0, s=0x80bd848, pconf=0x0, plog=0x0, ptemp=0x0,
> >     run_mode=MP_HOOK_RUN_FIRST) at modperl_callback.c:261
> > #7  0x402a7de5 in modperl_callback_per_dir (idx=6, r=0x825f8b8,
> > run_mode=MP_HOOK_RUN_FIRST) at modperl_callback.c:368
> > #8  0x402a34ee in modperl_response_handler_run (r=0x825f8b8, finish=0)
> > at mod_perl.c:979
> > #9  0x402a379b in modperl_response_handler_cgi (r=0x825f8b8) at mod_perl.c:1074
> > #10 0x0807eafb in ap_run_handler (r=0x825f8b8) at config.c:152
> > #11 0x08081535 in ap_invoke_handler (r=0x825f8b8) at config.c:364
> > #12 0x0806e0df in ap_process_request (r=0x825f8b8) at http_request.c:249
> > #13 0x08069669 in ap_process_http_connection (c=0x8257970) at http_core.c:251
> > #14 0x08088acb in ap_run_process_connection (c=0x8257970) at connection.c:43
> > #15 0x0807dc08 in child_main (child_num_arg=<value optimized out>) at
> > prefork.c:610
> > #16 0x0807dd91 in make_child (s=<value optimized out>, slot=0) at prefork.c:704
> > #17 0x0807de21 in startup_children (number_to_start=5) at prefork.c:722
> > #18 0x0807e4ed in ap_mpm_run (_pconf=0x80b90a8, plog=0x80f1188,
> > s=0x80bd848) at prefork.c:941
> > #19 0x080836fc in main (argc=3, argv=0xbffff444) at main.c:618
> > (gdb) define curinfo
> > Type commands for definition of "curinfo".
> > End with a line saying just "end".
> >
> >>    printf "%d:%s\n", PL_curcop->cop_line, \
> >
> >      ((XPV*)(*(XPVGV*)PL_curcop->cop_filegv->sv_any)\
> >      ->xgv_gp->gp_sv->sv_any)->xpv_pv
> >
> >> end
> >
> > (gdb) curinfo
> > 62:(eval 26)
> > (gdb)
>
> Can you :
>
> (gdb) print *m
> (gdb) print *cv
>
> ?

(gdb) run -X
Starting program: /usr/local/apache2/bin/httpd -X
[Thread debugging using libthread_db enabled]
[New Thread 1076002208 (LWP 18474)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1076002208 (LWP 18474)]
ap_get_module_config (cv=0x2, m=0x2) at util_debug.c:106
106         return ((void **)cv)[m->module_index];

(gdb) print *m
Cannot access memory at address 0x2

(gdb) print *cv
$1 = <incomplete type>


Ali ISIK

Re: [mp2] repeatable segfault at ap_get_module_config

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Ali ISIK wrote:
> -------------8<---------- Start Bug Report ------------8<----------
> 1. Problem Description:
> 
> I am building a web application with a Postgres backend using
> Class::DBI.  Some scripts generate repeatable Segmentation
> Faults on their second invocation.  I tried compiling everything
> with cc and then compiling everything with gcc.  Still the same
> segfaults.  Perl, Apache, mod_perl and the CPAN modules are
> all the latest stable versions.

Any chance at reducing these scripts to a short example that causes
this bug ?

> [...]
> 
> 3. This is the core dump trace: (if you get a core dump):
> 
> (gdb) where
> #0  ap_get_module_config (cv=0x30303320, m=0x30303320) at util_debug.c:106
> #1  0x40331f30 in Perl_pp_entersub () at pp_hot.c:2888
> #2  0x40314b9d in Perl_runops_debug () at dump.c:1452
> #3  0x402c48fa in S_call_body (myop=0xbfffeea0, is_eval=0) at perl.c:2364
> #4  0x402c4577 in Perl_call_sv (sv=0x8173398, flags=4) at perl.c:2282
> #5  0x402a7303 in modperl_callback (handler=0x8130b30, p=0x825f880,
> r=0x825f8b8, s=0x80bd848, args=0x8777914)
>     at modperl_callback.c:100
> #6  0x402a7a0e in modperl_callback_run_handlers (idx=6, type=4,
> r=0x825f8b8, c=0x0, s=0x80bd848, pconf=0x0, plog=0x0, ptemp=0x0,
>     run_mode=MP_HOOK_RUN_FIRST) at modperl_callback.c:261
> #7  0x402a7de5 in modperl_callback_per_dir (idx=6, r=0x825f8b8,
> run_mode=MP_HOOK_RUN_FIRST) at modperl_callback.c:368
> #8  0x402a34ee in modperl_response_handler_run (r=0x825f8b8, finish=0)
> at mod_perl.c:979
> #9  0x402a379b in modperl_response_handler_cgi (r=0x825f8b8) at mod_perl.c:1074
> #10 0x0807eafb in ap_run_handler (r=0x825f8b8) at config.c:152
> #11 0x08081535 in ap_invoke_handler (r=0x825f8b8) at config.c:364
> #12 0x0806e0df in ap_process_request (r=0x825f8b8) at http_request.c:249
> #13 0x08069669 in ap_process_http_connection (c=0x8257970) at http_core.c:251
> #14 0x08088acb in ap_run_process_connection (c=0x8257970) at connection.c:43
> #15 0x0807dc08 in child_main (child_num_arg=<value optimized out>) at
> prefork.c:610
> #16 0x0807dd91 in make_child (s=<value optimized out>, slot=0) at prefork.c:704
> #17 0x0807de21 in startup_children (number_to_start=5) at prefork.c:722
> #18 0x0807e4ed in ap_mpm_run (_pconf=0x80b90a8, plog=0x80f1188,
> s=0x80bd848) at prefork.c:941
> #19 0x080836fc in main (argc=3, argv=0xbffff444) at main.c:618
> (gdb) define curinfo
> Type commands for definition of "curinfo".
> End with a line saying just "end".
> 
>>    printf "%d:%s\n", PL_curcop->cop_line, \
> 
>      ((XPV*)(*(XPVGV*)PL_curcop->cop_filegv->sv_any)\
>      ->xgv_gp->gp_sv->sv_any)->xpv_pv
> 
>> end
> 
> (gdb) curinfo
> 62:(eval 26)
> (gdb)

Can you :

(gdb) print *m
(gdb) print *cv

?


-- 
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5