perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Aronesty <>
Subject Re: WELCOME to
Date Thu, 12 Feb 2009 15:33:08 GMT
-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:

It's well known that file-scoped lexicals don't work intuitively in
CGI programs under mod_perl.

When mod_perl calls the same CGI program twice, file-scoped lexicals
are not rebound.

Some people are aware of this, random posts to newsgroups will attest,
but this is not documented well enough.

Create a CGI as below, and run it many times, assigning different
CGI::param('foo') values to $x.
Lowering the number of children spawned in Apache will reduce the
number of times needed
to run the script in order to see the problem.

# this program sometimes prints old values for foo, but only under mod_perl!

 use CGI;
 my $x =CGI::param('foo');


 sub y {
        print "content-type:text/plain\n\n?$x\n";

People using mod_perl expect CGI programs to behave similarly to how
they did before mod_perl.

mod_perl should be *extremely* verbose in pointing this change out to
developers, as
it is *extremely* difficult to diagnose.

Alternatively, it should be fixed.  But I'm not sure how, since most
solutions involve creating
anonymous package scopes which require the recompiling and ruining of
mod_perl's speed

Maybe there should just be a big fat warning on the top of the CGI
module and at the top of mod_perl,
"Don't use file-scoped lexicals!"  Or something like that.

2. Used Components and their Configuration:

*** mod_perl version 2.000003

*** using /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/Apache2/

*** Makefile.PL options:
  MP_APR_CONFIG  => /usr/bin/apr-1-config
  MP_APR_LIB     => aprext
  MP_APXS        => /usr/sbin/apxs
  MP_COMPAT_1X   => 1
  MP_LIBNAME     => mod_perl
  MP_USE_DSO     => 1

*** The httpd binary was not found

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

 -laprutil-1 -lldap -llber -ldb-4.5 -lexpat
 -lapr-1  -lpthread -ldl

*** /usr/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
    osname=linux, osvers=2.6.18-53.1.14.el5xen, archname=i386-linux-thread-multi
2.6.18-53.1.14.el5xen #1 smp tue feb 19 07:33:17 est 2008 i686 i686
i386 gnulinux '
    config_args='-des -Doptimize=-O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -Dversion=5.8.8 -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=n -Ubincompat5005 -Uversiononly
-Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto
-Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto
-Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto
-Dinc_version_list=5.8.7 5.8.6 5.8.5 -Dscriptdir=/usr/bin'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE
-fno-strict-aliasing -pipe -Wdeclaration-after-statement
    optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386
-mtune=generic -fasynchronous-unwind-tables',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
-Wdeclaration-after-statement -I/usr/local/include
    ccversion='', gccversion='4.1.2 20070925 (Red Hat 4.1.2-27)',
    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',
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/, so=so, useshrplib=true,
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -L/usr/local/lib'

Characteristics of this binary (from libperl):
                        USE_PERLIO USE_REENTRANT_API
  Built under linux
  Compiled at May  5 2008 10:33:58

*** Packages of interest status:

Apache2            : -
Apache2::Request   : -
CGI                : 3.15
ExtUtils::MakeMaker: 6.30
LWP                : 5.805
mod_perl           : -
mod_perl2          : 2.000003

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


This report was generated by /usr/bin/mp2bug on Thu Feb 12 15:14:33 2009 GMT.

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

Note: Complete the rest of the details and post this bug report to
modperl <at> To subscribe to the list send an empty
email to

View raw message