Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 68223 invoked from network); 13 Dec 2005 16:47:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Dec 2005 16:47:34 -0000 Received: (qmail 67159 invoked by uid 500); 13 Dec 2005 16:47:21 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 67078 invoked by uid 500); 13 Dec 2005 16:47:20 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 67067 invoked by uid 99); 13 Dec 2005 16:47:20 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Dec 2005 08:47:20 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [62.249.237.101] (HELO tignes.axomic.com) (62.249.237.101) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Dec 2005 08:47:19 -0800 Received: from morzine (internal [192.168.0.2]) by tignes.axomic.com (8.12.8/8.12.8) with ESMTP id jBDHhV73024574 for ; Tue, 13 Dec 2005 17:43:32 GMT Date: Tue, 13 Dec 2005 16:42:41 +0000 (GMT) From: Peter Walsham X-X-Sender: peter@localhost.localdomain To: modperl@perl.apache.org Subject: [mp2] local %ENV causes Segmentation fault or Bus error Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N -------------8<---------- Start Bug Report ------------8<---------- 1. Problem Description: Summary ============ Calling "local %ENV" from anywhere inside a mod_perl handler will terminally flaw the httpd process. The httpd process will function fine on the first request, but will die the next time it is asked to handle a request. Apache error.log or error_log will contain one of the following. [notice] child pid exit signal Segmentation fault (11) [notice] child pid exit signal Bus error (10) Calling local %ENV seems fine on: mod_perl 1.99_09 Calling local %ENV creates a terminal flaw on: mod_perl 1.99_16 mod_perl 1.999_21 mod_perl 2.0.2 I spotted this because I was using Sys::HostIP, which has been calling local %ENV inside _get_unix_interface_info since version 1.1 (07 Apr 2002). http://search.cpan.org/src/BLUELINES/Sys-HostIP-1.1/HostIP.pm http://search.cpan.org/src/BLUELINES/Sys-HostIP-1.3.1/HostIP.pm Some example test files are given below. Testing Performed On ========================= Main tests on: Fedora Core 3 Mac OS X 10.3.9 Results were consistent with other installs on: Red Hat 9 Fedora Core 2 (FC2) Fedora Core 4 (FC4) Red Hat Enterprise Linux 3 (RHEL3) Mac OS X 10.4.3 Windows Server 2000 Windows Server 2003 Windows XP Pro Configuring httpd.conf =========================== For ease of testing reduce the number of forked httpd processes in httpd.conf: StartServers 1 MinSpareServers 1 MaxSpareServers 1 MaxClients 150 MaxRequestsPerChild 0 Fedora Core 3 ================== First tried with the RPMs FC3 came with: httpd-2.0.52-3.i386.rpm mod_perl-1.99_16-3.rpm Then upgraded to latest mod_perl and Apache to see if the problem had been fixed (which it hadn't). mod_perl 2.0.2 (VERSION 2.000002) Apache 2.0.53 Perl 5.8.5 The process dies with: [notice] child pid exit signal Segmentation fault (11) FILE: Mod_Perl_ENV_Bug_Test.conf LoadModule perl_module modules/mod_perl.so Listen 80 PerlOptions +Parent PerlSwitches -Mlib=/home/myhome/Mod_Perl_ENV_Bug_Test PerlModule Bundle::Apache2 PerlModule MyHandler SetHandler perl-script PerlResponseHandler MyHandler FILE: /home/myhome/Mod_Perl_ENV_Bug_Test/MyHandler.pm package MyHandler; use strict; use warnings; use Apache2::RequestRec (); use Apache2::Const ('-compile',('OK')); use Sys::HostIP; sub handler($) { my $r = shift(); # The error is produced by either of the following two lines local %ENV; #Sys::HostIP->ips(); $r->content_type('text/html'); print('Testing'); return Apache2::Const::OK; } 1; Mac OS X 10.3.9 ==================== mod_perl was compiled from source. Darwin Kernel Version 7.9.0 mod_perl 2.0.0-RC4 (VERSION 1.999021) Apache 2.0.52 Perl 5.8.1-RC3 The process dies with: [notice] child pid exit signal Bus error (10) FILE: Mod_Perl_ENV_Bug_Test.conf LoadModule perl_module modules/mod_perl.so Listen 80 PerlOptions +Parent PerlSwitches -Mlib=/home/myhome/Mod_Perl_ENV_Bug_Test PerlModule Apache2 PerlModule MyHandler SetHandler perl-script PerlResponseHandler MyHandler FILE: /home/myhome/Mod_Perl_ENV_Bug_Test/MyHandler.pm package MyHandler; use strict; use warnings; use Apache::RequestRec (); use Apache::Const -compile=>qw(OK); use Sys::HostIP; sub handler($) { my $r = shift(); # The error is produced by either of the following two lines local %ENV; #Sys::HostIP->ips(); $r->content_type('text/html'); print('Testing'); return Apache::OK; } 1; =============================== OpenAsset - Image Management for Architects, Designers & Engineers Axomic Ltd 338 City Road London EC1V 2PY t: +44 (0)20 7239 8287 m: +44 (0)7812 122418 http://www.axomic.com 2. Used Components and their Configuration: *** mod_perl version 1.9916 *** using /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/Apache/BuildConfig.pm *** Makefile.PL options: MP_APR_CONFIG => /usr/bin/apr-config MP_APR_LIB => aprext MP_APXS => /usr/sbin/apxs MP_COMPAT_1X => 1 MP_GENERATE_XS => 1 MP_LIBNAME => mod_perl MP_USE_DSO => 1 MP_USE_STATIC => 1 *** The httpd binary was not found *** (apr|apu)-config linking info -lapr-0 -lrt -lm -lcrypt -lpthread -ldl -laprutil-0 -lldap -llber -ldb-4.2 -lexpat *** /usr/bin/perl -V Summary of my perl5 (revision 5 version 8 subversion 5) configuration: Platform: osname=linux, osvers=2.4.21-14.elsmp, archname=i386-linux-thread-multi uname='linux tweety.build.redhat.com 2.4.21-14.elsmp #1 smp wed apr 14 18:55:47 edt 2004 i686 i686 i386 gnulinux ' config_args='-des -Doptimize=-O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -Dversion=5.8.5 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dinc_version_list=5.8.4 5.8.3 5.8.2 5.8.1 5.8.0' 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='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2 -g -pipe -m32 -march=i386 -mtune=pentium4', cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='3.4.2 20041006 (Red Hat 3.4.2-5)', 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 -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,/usr/lib/perl5/5.8.5/i386-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 Oct 12 2004 12:45:01 %ENV: PERL_LWP_USE_HTTP_10="1" @INC: /usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl . *** Packages of interest status: Apache::Request: - CGI : 3.05 LWP : 5.79 mod_perl : 1.9916 3. This is the core dump trace: (if you get a core dump): [CORE TRACE COMES HERE] This report was generated by /usr/bin/mp2bug on Mon Dec 12 17:16:51 2005 GMT. -------------8<---------- End Bug Report --------------8<---------- Note: Complete the rest of the details and post this bug report to modperl perl.apache.org. To subscribe to the list send an empty email to modperl-subscribe@perl.apache.org.