perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject [mp2] segfaults with Apache::Reload
Date Tue, 22 Mar 2005 00:04:26 GMT
I get segfaults after Apache::Reload has reloaded a module. I've attached 
a tarball which reproduces the segfault(s).

It could be a problem in A-R, in the perl, in the modperl or any mix of 
the three.

Just run the following (adjust the paths):

make clean
perl-5.8.6-ithread Makefile.PL -apxs /home/stas/httpd/prefork/bin/apxs \
-libmodperl mod_perl-5.8.6-ithread.so
make
make test TEST_VERBOSE=1


ok 1
ok 2
request has failed (the response code was: 500)
see t/logs/error_log for more details


[Mon Mar 21 18:45:16 2005] [debug] prefork.c(956): AcceptMutex: sysvsem 
(default: sysvsem)
Apache::Reload: Checking mtime of Apache/Handler.pm
Apache::Reload: Checking mtime of Apache/Handler.pm
Apache::Reload: Checking mtime of Apache/Handler.pm
Apache::Reload: process 30830 reloading Apache::Handler from Apache/Handler.pm
Use of uninitialized value.
Apache::Reload: Checking mtime of Apache/Handler.pm
[Mon Mar 21 18:45:19 2005] [error] [client 127.0.0.1] Attempt to free 
unreferenced scalar: SV 0x8173b9c, Perl interpreter: 0x8265448 at 
/home/stas/perl/5.8.6-ithread/lib/site_perl/5.8.6/i686-linux-thread-multi/Apache2/Apache/Reload.pm

line 157.

the segfaults vary from run to run, sometimes I get:

#0  0x4052ae78 in Perl_mg_find (my_perl=0x81a4500, sv=0x8221b60, type=116) 
at mg.c:359
359             if (mg->mg_type == type)
(gdb) bt
#0  0x4052ae78 in Perl_mg_find (my_perl=0x81a4500, sv=0x8221b60, type=116) 
at mg.c:359
#1  0x405598ef in Perl_sv_tainted (my_perl=0x81a4500, sv=0x8221b60) at 
sv.c:8036
#2  0x40551452 in Perl_sv_setsv_flags (my_perl=0x81a4500, dstr=0x81f470c,
     sstr=0x8221b60, flags=2) at sv.c:4101
#3  0x40557579 in Perl_sv_mortalcopy (my_perl=0x81a4500, oldstr=0x8221b60) 
at sv.c:6768
#4  0x4058699b in Perl_pp_return (my_perl=0x81a4500) at pp_ctl.c:1895
#5  0x405239a9 in Perl_runops_debug (my_perl=0x81a4500) at dump.c:1449
#6  0x404c8e26 in S_call_body (my_perl=0x81a4500, myop=0xbfffce20, is_eval=0)
     at perl.c:2298
#7  0x404c8952 in Perl_call_sv (my_perl=0x81a4500, sv=0x8149f30, flags=4) 
at perl.c:2216
#8  0x4047b364 in modperl_callback (my_perl=0x81a4500, handler=0x8243aa0, 
p=0x81a1858,
     r=0x81a18a8, s=0x8192f50, args=0x8161274) at modperl_callback.c:100
#9  0x4047bc40 in modperl_callback_run_handlers (idx=6, type=4, 
r=0x81a18a8, c=0x0,
     s=0x8192f50, pconf=0x0, plog=0x0, ptemp=0x0, run_mode=MP_HOOK_RUN_FIRST)
     at modperl_callback.c:261
#10 0x4047c087 in modperl_callback_per_dir (idx=6, r=0x81a18a8,
     run_mode=MP_HOOK_RUN_FIRST) at modperl_callback.c:368
#11 0x4047461f in modperl_response_handler_run (r=0x81a18a8, finish=0) at 
mod_perl.c:978
#12 0x404749bc in modperl_response_handler_cgi (r=0x81a18a8) at 
mod_perl.c:1073

at other times:

#0  0x4039b971 in free () from /lib/tls/libc.so.6
(gdb) bt
#0  0x4039b971 in free () from /lib/tls/libc.so.6
#1  0x4039d3f1 in malloc () from /lib/tls/libc.so.6
#2  0x402a2e3a in pool_alloc (pool=0x81badb8, size=16) at apr_pools.c:1277
#3  0x402a2f59 in apr_palloc_debug (pool=0x81badb8, size=16,
     file_line=0x40185160 "apr_brigade.c:66") at apr_pools.c:1317
#4  0x40174bc4 in apr_brigade_create (p=0x81badb8, list=0x8213180) at 
apr_brigade.c:66
#5  0x080ef026 in ap_save_brigade (f=0x8262628, saveto=0x8174520, 
b=0xbfffd5b4,
     p=0x81badb8) at util_filter.c:528
#6  0x080f9e57 in core_output_filter (f=0x8262628, b=0x81d7678) at core.c:4163
#7  0x080eefe9 in ap_pass_brigade (next=0x8262628, bb=0x81a3a80) at 
util_filter.c:512
#8  0x080aa7b5 in ap_http_header_filter (f=0x821ec68, b=0x81a3a80)
     at http_protocol.c:1691
#9  0x080eefe9 in ap_pass_brigade (next=0x821ec68, bb=0x81a3a80) at 
util_filter.c:512
#10 0x080f1f43 in ap_content_length_filter (f=0x821ec50, b=0x81a3a80) at 
protocol.c:1232
#11 0x080eefe9 in ap_pass_brigade (next=0x821ec50, bb=0x81a3a80) at 
util_filter.c:512
#12 0x080ac232 in ap_byterange_filter (f=0x821ec38, bb=0x81a3a80)
     at http_protocol.c:2876
#13 0x080eefe9 in ap_pass_brigade (next=0x821ec38, bb=0x81a3a80) at 
util_filter.c:512
#14 0x080f22d8 in ap_old_write_filter (f=0x8260ce8, bb=0x81a3a80) at 
protocol.c:1301
#15 0x080eefe9 in ap_pass_brigade (next=0x8260ce8, bb=0x8260ff0) at 
util_filter.c:512
#16 0x080f18d2 in end_output_stream (r=0x8262898) at protocol.c:1023
#17 0x080f1924 in ap_finalize_request_protocol (r=0x8262898) at 
protocol.c:1045
#18 0x080ab8b9 in ap_send_error_response (r=0x8262898, recursive_error=0)
     at http_protocol.c:2418
#19 0x080ad14a in ap_die (type=500, r=0x8262898) at http_request.c:191
---Type <return> to continue, or q <return> to quit---
#20 0x080f168d in ap_read_request (conn=0x81a0310) at protocol.c:971
#21 0x080a6c6d in ap_process_http_connection (c=0x81a0310) at http_core.c:244
#22 0x080ebfa8 in ap_run_process_connection (c=0x81a0310) at connection.c:43
#23 0x080ec472 in ap_process_connection (c=0x81a0310, csd=0x8262368) at 
connection.c:176
#24 0x080ddc86 in child_main (child_num_arg=0) at prefork.c:610
#25 0x080dde10 in make_child (s=0x8217378, slot=0) at prefork.c:704
#26 0x080dde83 in startup_children (number_to_start=1) at prefork.c:722
#27 0x080de290 in ap_mpm_run (_pconf=0x8137758, plog=0x8146888, s=0x8217378)

When running the touching script outside the test:

perl -e 'system qq[touch lib/Apache/Handler.pm] while 1'

or sometimes within the attached test suite. I was getting the following 
segfault as if it wasn't finding the sub entry.

#0  0x08141d90 in ?? ()
(gdb) bt
#0  0x08141d90 in ?? ()
#1  0x405475a5 in Perl_pp_entersub (my_perl=0x8253528) at pp_hot.c:2890
#2  0x405239a9 in Perl_runops_debug (my_perl=0x8253528) at dump.c:1449
#3  0x404c8e26 in S_call_body (my_perl=0x8253528, myop=0xbfffda00, is_eval=0)
     at perl.c:2298
#4  0x404c8952 in Perl_call_sv (my_perl=0x8253528, sv=0x819da98, flags=4) 
at perl.c:2216
#5  0x4047b364 in modperl_callback (my_perl=0x8253528, handler=0x81ddb38, 
p=0x81a2458,
     r=0x81a24a8, s=0x821c0d0, args=0x8200a30) at modperl_callback.c:100
#6  0x4047bc40 in modperl_callback_run_handlers (idx=6, type=4, 
r=0x81a24a8, c=0x0,
     s=0x821c0d0, pconf=0x0, plog=0x0, ptemp=0x0, run_mode=MP_HOOK_RUN_FIRST)
     at modperl_callback.c:261
#7  0x4047c087 in modperl_callback_per_dir (idx=6, r=0x81a24a8,
     run_mode=MP_HOOK_RUN_FIRST) at modperl_callback.c:368
#8  0x4047461f in modperl_response_handler_run (r=0x81a24a8, finish=0) at 
mod_perl.c:978
#9  0x404749bc in modperl_response_handler_cgi (r=0x81a24a8) at 
mod_perl.c:1073
#10 0x080df3d4 in ap_run_handler (r=0x81a24a8) at config.c:152
#11 0x080dfaf1 in ap_invoke_handler (r=0x81a24a8) at config.c:364
#12 0x080ad2de in ap_process_request (r=0x81a24a8) at http_request.c:249
#13 0x080a6cb4 in ap_process_http_connection (c=0x823d120) at http_core.c:251
#14 0x080ebfa8 in ap_run_process_connection (c=0x823d120) at connection.c:43
#15 0x080ec472 in ap_process_connection (c=0x823d120, csd=0x81a3de0) at 
connection.c:176
#16 0x080ddc86 in child_main (child_num_arg=0) at prefork.c:610
#17 0x080dde10 in make_child (s=0x821c0d0, slot=0) at prefork.c:704
#18 0x080dde83 in startup_children (number_to_start=1) at prefork.c:722

notice that all happen when Apache::Reload reloads the changes script. The 
minimized handler appears to be:

package Apache::Handler;

use strict;
use warnings;

BEGIN {
     require Apache::Const;
     Apache::Const->import('OK');
}

sub handler_mp2 { &run }
*handler = \&handler_mp2;

sub run {
     print "a";
     return OK;
}

sub new { }

1;
__END__

the *handler setting and import of OK seem to cause the problem. Probably 
two are unrelated.


2. Used Components and their Configuration:

*** mod_perl version 1.999022

*** using /home/stas/apache.org/mp2-svn/lib/Apache/BuildConfig.pm

*** Makefile.PL options:
   MP_APR_LIB      => aprext
   MP_APXS         => /home/stas/httpd/prefork/bin/apxs
   MP_CCOPTS       => -Wall -Werror
   MP_COMPAT_1X    => 1
   MP_DEBUG        => 1
   MP_GENERATE_XS  => 1
   MP_INST_APACHE2 => 1
   MP_LIBNAME      => mod_perl
   MP_MAINTAINER   => 1
   MP_TRACE        => 1
   MP_USE_DSO      => 1
   MP_USE_GTOP     => 1


*** /home/stas/httpd/prefork/bin/httpd -V
Server version: Apache/2.0.54-dev
Server built:   Feb 18 2005 12:42:11
Server's Module Magic Number: 20020903:9
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_SYSVSEM_SERIALIZE
  -D APR_USE_PTHREAD_SERIALIZE
  -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  -D APR_HAS_OTHER_CHILD
  -D AP_HAVE_RELIABLE_PIPED_LOGS
  -D HTTPD_ROOT="/home/stas/httpd/prefork"
  -D SUEXEC_BIN="/home/stas/httpd/prefork/bin/suexec"
  -D DEFAULT_PIDLOG="logs/httpd.pid"
  -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
  -D DEFAULT_LOCKFILE="logs/accept.lock"
  -D DEFAULT_ERRORLOG="logs/error_log"
  -D AP_TYPES_CONFIG_FILE="conf/mime.types"
  -D SERVER_CONFIG_FILE="conf/httpd.conf"


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

  -L/home/stas/httpd/prefork/lib -lapr-0 -lrt -lm -lcrypt -lnsl  -lpthread 
-ldl
  -L/home/stas/httpd/prefork/lib -laprutil-0 -lgdbm -ldb-4.2 -lexpat



*** /home/stas/perl/5.8.6-ithread/bin/perl5.8.6 -V
Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
   Platform:
     osname=linux, osvers=2.6.8.1-12mdk, archname=i686-linux-thread-multi
     uname='linux rabbit.stason.org 2.6.8.1-12mdk #1 fri oct 1 12:53:41 
cest 2004 i686 mobile intel(r) pentium(r) 4 - m cpu 2.00ghz unknown gnulinux '
     config_args='-des -Dprefix=/home/stas/perl/5.8.6-ithread -Dusethreads 
-Doptimize=-g -Duseshrplib -Dusedevel -Accflags=-DDEBUG_LEAKING_SCALARS'
     hint=recommended, useposix=true, d_sigaction=define
     usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=define
     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
     use64bitint=undef use64bitall=undef uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-DDEBUG_LEAKING_SCALARS -DDEBUGGING -fno-strict-aliasing -pipe 
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
-I/usr/include/gdbm',
     optimize='-g',
     cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-DDEBUG_LEAKING_SCALARS -DDEBUGGING -fno-strict-aliasing -pipe 
-I/usr/local/include -I/usr/include/gdbm'
     ccversion='', gccversion='3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)', 
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 -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
     libc=/lib/libc-2.3.3.so, so=so, useshrplib=true, libperl=libperl.so
     gnulibc_version='2.3.3'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E 
-Wl,-rpath,/home/stas/perl/5.8.6-ithread/lib/5.8.6/i686-linux-thread-multi/CORE'
     cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
   Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS 
USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
   Built under linux
   Compiled at Feb 23 2005 18:11:50
   %ENV:
     PERLDOC_PAGER="less -R"
     PERL_LWP_USE_HTTP_10="1"
   @INC:
     /home/stas/perl/5.8.6-ithread/lib/5.8.6/i686-linux-thread-multi
     /home/stas/perl/5.8.6-ithread/lib/5.8.6
     /home/stas/perl/5.8.6-ithread/lib/site_perl/5.8.6/i686-linux-thread-multi
     /home/stas/perl/5.8.6-ithread/lib/site_perl/5.8.6
     /home/stas/perl/5.8.6-ithread/lib/site_perl
     .

*** Packages of interest status:

Apache::Request: -
CGI            : 3.05
LWP            : 5.803
mod_perl       : 1.2901, 1.999022

-- 
__________________________________________________________________
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

Mime
View raw message