Hello!
Here is a simple Test.pm handler that causes segfaults in our server. The Test.pm uses XS for creating configuration settings. The purpose is to set 'Testing' flag on or off in .htaccess files. I tried to make the module as simple as possible. The specifications are in the attachments files. sf_install.txt contains the information about the mod_perl compilation and the test module. sf_case1.txt contains the backtrace in Mandrake 8.1 with perl 5.6.1 while the sf_case2.txt contains the backtrace from Debian 2.2 with perl 5.005_3. To sum up the attachments, the error_log gives warnings like: [debug] mod_perl.c(1322): [warning] PerlFixupHandler stack is not an ARRAY! and the backtrace gives information like: ... type=0x81264d4 "SERVER_CREATE") at perl_config.c:896 The segfault problems seems to haunt me whenever I try to create new configuration directives. In fact the different and unsolved segfaults have made me test many combinations with different versions of linux, perl, apache and mod_perl during the last year. Maybe better luck with solaris? Too bad that propably the fault lies with me. Of course, I'm more than happy to test/give more info about the segfault problem! Best wishes, -- Kari Nurmela, [EMAIL PROTECTED], (02) 333 8847 / (0400) 786 547 University of Turku, Finland
CASE 2 ====== Debian 2.2 (stable) Linux aura 2.2.19pre17-compact #1 Mon Apr 2 01:35:19 PDT 2001 i586 unknown perl -V: Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: Platform: osname=linux, osvers=2.2.15pre14, archname=i386-linux uname='linux them 2.2.15pre14 #2 smp mon mar 13 14:29:00 est 2000 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 20000313 (Debian GNU/Linux) cppflags='-Dbool=char -DHAS_BOOL -D_REENTRANT -DDEBIAN -I/usr/local/include' ccflags ='-Dbool=char -DHAS_BOOL -D_REENTRANT -DDEBIAN -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 -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -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 Apr 30 2000 12:08:38 %ENV: PERLPREFIX="/usr/local/wm5/perl" @INC: /usr/lib/perl5/5.005/i386-linux /usr/lib/perl5/5.005 /usr/local/lib/site_perl/i386-linux /usr/local/lib/site_perl /usr/lib/perl5 . BACKTRACE ========= [karnurme@sapphire apache]$ gdb /usr/local/wm5/apache/bin/httpd (gdb) run -X -f /usr/local/wm5/apache/conf/httpd.conf -d /usr/local/wm5/apache Starting program: /usr/local/wm5/apache/bin/httpd -X -f /usr/local/wm5/apache/conf/httpd.conf -d /usr/local/wm5/apache (no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... Program received signal SIGSEGV, Segmentation fault. 0x807dad2 in perl_get_module_ptr () (gdb) bt #0 0x807dad2 in perl_get_module_ptr () #1 0x807ddb5 in perl_get_module_ptr () #2 0x807e132 in perl_cmd_perl_TAKE123 () #3 0x807da09 in perl_cmd_perl_FLAG () #4 0x8097e84 in ap_clear_module_list () #5 0x8098151 in ap_handle_command () #6 0x80981ed in ap_srm_command_loop () #7 0x8098a92 in ap_parse_htaccess () #8 0x80aa022 in ap_send_error_response () #9 0x80ab457 in ap_some_auth_required () #10 0x80ab916 in ap_process_request () #11 0x80a2880 in ap_child_terminate () #12 0x80a2a41 in ap_child_terminate () #13 0x80a2bbc in ap_child_terminate () #14 0x80a322c in ap_child_terminate () #15 0x80a3a5c in main () #16 0x400d4a42 in __libc_start_main () from /lib/libc.so.6 (gdb) karnurme@aura:~/wm5$ less apache/logs/error_log [Mon Nov 5 17:02:45 2001] [notice] Apache/1.3.20 (Unix) mod_perl/1.26 configured -- resuming normal operations [Mon Nov 5 17:03:22 2001] [notice] child pid 12686 exit signal Segmentation fault (11), possible coredump in /usr/local/wm5/apache BACKTRACE WITH NEW LIBPERL ========================== cd apache_1.3.20/src/modules/perl rm *.[oa] make LIBPERL=libperld.a cp libperl.a /usr/lib/perl5/5.005/i386-linux/ cd mod_perl-1.26/ make install (gdb) run -X -f `pwd`/t/conf/httpd.conf -d `pwd`/t Starting program: /usr/local/wm5/install/mod_perl-1.26/../apache_1.3.20/src/httpd -X -f `pwd`/t/conf/httpd.conf -d `pwd`/t (FETCHING THE URL http://localhost:8529/dir/ WHERE .HTACCESS FILE) Program received signal SIGSEGV, Segmentation fault. 0x807dad2 in perl_perl_create_cfg (sv=0x85d8654, pclass=0x831651c, parms=0xbffff82c, type=0x81264d4 "SERVER_CREATE") at perl_config.c:896 896 GV *gv; (gdb) bt #0 0x807dad2 in perl_perl_create_cfg (sv=0x85d8654, pclass=0x831651c, parms=0xbffff82c, type=0x81264d4 "SERVER_CREATE") at perl_config.c:896 #1 0x807ddb5 in perl_perl_create_srv_config (sv=0x85d8654, pclass=0x831651c, parms=0xbffff82c) at perl_config.c:941 #2 0x807e132 in perl_cmd_perl_TAKE123 (cmd=0xbffff82c, data=0x85d863c, one=0xbfffd73a "1", two=0x0, three=0x0) at perl_config.c:1038 #3 0x807da09 in perl_cmd_perl_FLAG (cmd=0xbffff82c, data=0x85d863c, flag=1) at perl_config.c:871 #4 0x8097e84 in invoke_cmd (cmd=0x401e24c8, parms=0xbffff82c, mconfig=0x85d863c, args=0xbfffd7f6 "") at http_config.c:949 #5 0x8098151 in ap_handle_command (parms=0xbffff82c, config=0x85d83ac, l=0xbfffd7ec "Testing On") at http_config.c:1029 #6 0x80981ed in ap_srm_command_loop (parms=0xbffff82c, config=0x85d83ac) at http_config.c:1043 #7 0x8098a92 in ap_parse_htaccess (result=0xbffff898, r=0x85d7264, override=31, d=0x85d827c "/usr/local/wm5/install/mod_perl-1.26/t/docs/dir/", access_name=0x812cb9d "") at http_config.c:1359 #8 0x80aa022 in directory_walk (r=0x85d7264) at http_request.c:576 #9 0x80ab457 in process_request_internal (r=0x85d7264) at http_request.c:1226 #10 0x80ab916 in ap_process_request (r=0x85d7264) at http_request.c:1323 #11 0x80a2880 in child_main (child_num_arg=0) at http_main.c:4209 #12 0x80a2a41 in make_child (s=0x81563bc, slot=0, now=1004972912) at http_main.c:4313 #13 0x80a2bbc in startup_children (number_to_start=5) at http_main.c:4395 #14 0x80a322c in standalone_main (argc=6, argv=0xbffffae4) at http_main.c:4683 #15 0x80a3a5c in main (argc=6, argv=0xbffffae4) at http_main.c:5010 (gdb) karnurme@aura:~/wm5/install$ less mod_perl-1.26/t/logs/error_log [notice] Destruction->DESTROY called for $global_object [Mon Nov 5 17:06:20 2001] [warn] [notice] child_init for process 12702, report any problems to [no address given] [Mon Nov 5 17:08:31 2001] [warn] pid file /usr/local/wm5/install/mod_perl-1.26/t/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run? [notice] Destruction->DESTROY called for $global_object [Mon Nov 5 17:08:32 2001] [warn] [notice] child_init for process 12716, report any problems to [no address given] [Mon Nov 5 17:11:26 2001] [error] [client 130.232.4.112] File does not exist: /usr/local/wm5/install/mod_perl-1.26/t/docs/dir/ [Mon Nov 5 17:11:49 2001] [error] [client 130.232.4.112] File does not exist: /usr/local/wm5/install/mod_perl-1.26/t/docs/favicon.ico [Mon Nov 5 17:12:04 2001] [error] [client 130.232.4.112] File does not exist: /usr/local/wm5/install/mod_perl-1.26/t/docs/favicon.ico error_log (END)
CASE 1 ====== Mandrake 8.1, Linux sapphire 2.4.8-26mdk #1 Sun Sep 23 17:06:39 CEST 2001 i686 unknown perl -V: Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: Platform: osname=linux, osvers=2.4.8-11mdkenterprise, archname=i386-linux uname='linux no.mandrakesoft.com 2.4.8-11mdkenterprise #1 smp wed aug 22 16:05:18 cest 2001 i686 unknown ' config_args='-des -Darchname=i386-linux -Dd_dosuid -Ud_csh -Duseshrplib -Doptimize=-O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -ffast-math -fno-strength-reduce -Dprefix=/usr -Di_ndbm -Di_gdbm -Di_shadow -Di_syslog -Uuselargefiles -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/lib/perl5/man/man3' 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='cc', ccflags ='-fno-strict-aliasing', optimize='-O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -ffast-math -fno-strength-reduce', cppflags='-fno-strict-aliasing' ccversion='', gccversion='2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk)', 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='cc', 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=true, libperl=libperl.so Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.6.1/i386-linux/CORE' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: Built under linux Compiled at Sep 9 2001 23:58:45 %ENV: PERL5LIB="/usr/local/wm5/perl/lib/site_perl/5.6.1/i386-linux" @INC: /usr/local/wm5/perl/lib/site_perl/5.6.1/i386-linux /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 . EARLIER ERROR_LOG WITH PERLDEBUG=1 ================================== [karnurme@sapphire karnurme]$ less /usr/local/wm5/apache/logs/error_log [Thu Nov 1 18:05:13 2001] [notice] child pid 12875 exit signal Segmentation fault (11) [Thu Nov 1 18:05:20 2001] [notice] child pid 12877 exit signal Segmentation fault (11) [Thu Nov 1 18:05:23 2001] [debug] mod_perl.c(1322): [warning] PerlFixupHandler stack is not an ARRAY! SV = RV(0x80f6350) at 0x81771a0 REFCNT = 1 FLAGS = (ROK) RV = 0x8176e40 [Thu Nov 1 18:05:24 2001] [notice] child pid 12878 exit signal Segmentation fault (11) [Thu Nov 1 18:05:45 2001] [debug] mod_perl.c(1322): [warning] PerlFixupHandler stack is not an ARRAY! SV = RV(0x80f6350) at 0x81771a0 REFCNT = 1 FLAGS = (ROK) RV = 0x8176e40 [Thu Nov 1 18:05:58 2001] [debug] mod_perl.c(1322): [warning] PerlFixupHandler stack is not an ARRAY! SV = RV(0x80f6364) at 0x817f560 REFCNT = 1 FLAGS = (ROK) RV = 0x81771dc BACKTRACE ========= [karnurme@sapphire apache]$ gdb /usr/local/wm5/apache/bin/httpd GNU gdb 20010813 (MI_OUT) ... (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 (no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)... (FETCHING THE URL http://localhost:8800/dir/ WHERE .HTACCESS FILE) Program received signal SIGSEGV, Segmentation fault. 0x08071405 in perl_pod_section () (gdb) bt #0 0x08071405 in perl_pod_section () #1 0x402a32e0 in _fini () from /usr/local/wm5/perl/lib/site_perl/5.6.1/i386-linux/auto/Apache/WorkMates/Test/Test.so #2 0x435f5245 in ?? () (gdb)
INSTALLING MOD_PERL & APACHE ============================ mod_perl 1.26 apache 1.3.20 Making mod_perl & apache (now WM5_DIR=/usr/local/wm5 and PERLPREFIX=$WM5_DIR/perl) perl Makefile.PL \ PREFIX=$PERLPREFIX \ APACHE_SRC=$WM5_DIR/install/$APACHE_SRC/src \ APACHE_PREFIX=$WM5_DIR/apache \ DO_HTTPD=1 \ USE_APACI=1 \ EVERYTHING=1 \ PERL_DEBUG=1 make && make install In case LWP is installed, the 'make test' is successful. THE TEST PROGRAM ================ package Apache::WorkMates::Test; use strict; use Apache::Constants qw(OK); use Apache::ModuleConfig (); use DynaLoader (); use vars qw($VERSION); $VERSION = 0.01; if ($ENV{MOD_PERL}) { no strict; @ISA = qw(DynaLoader); __PACKAGE__->bootstrap($VERSION); } sub handler { my $r = shift; my $cfg = Apache::ModuleConfig->get($r); $r->send_http_header('text/plain'); $r->print('Hello.'); return OK; } sub Testing { my ($cfg, $parms, $arg) = @_; $cfg->{Testing} = $arg; } 1; THE Makefile.PL =============== package Apache::WorkMates::Test; use strict; use ExtUtils::MakeMaker; use Apache::ExtUtils qw(command_table); use Apache::src (); my @directives = ( { name => 'Testing', errmsg => 'Testing on/off', args_how=> 'FLAG', req_override => 'OR_ALL' }); command_table(\@directives); WriteMakefile( 'NAME' => 'Apache::WorkMates::Test', 'VERSION_FROM' => 'Test.pm', 'INC' => Apache::src->new->inc ); 1; THE HTACCESS FILE ================= The file is in apache/htdocs/dir/ PerlModule Apache::WorkMates::Test Testing On