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

Summary: mod_perl is making httpd segfault.

I'm developing a PerlAccessHandler that will check for a
cookie to see if the user has accepted a legal agreement before
allowing them to visit a page.  If the cookie is not present, they'll
be redirected to a form where they read and perhaps accept the
agreement.

The way I'm implementing this may not be kosher (I'm just dipping
my toes in the mod_perl waters now), but I'd expect to get an
error, not a segfault.

Note: all tests passed when I built mod_perl.


>From error_log:

    [Thu Nov 15 13:40:15 2007] [notice] child pid 21284 exit signal
Segmentation fault (11)

>From httpd.conf:

    Alias /mp/ /data/software/www/mp/
    PerlRequire /data/software/www/mp/startup.pl
    <Location /mp>
        SetHandler perl-script
        PerlResponseHandler ModPerl::Registry
        PerlOptions +ParseHeaders
        Options +ExecCGI
        Order allow,deny
        Allow from all
    </Location>

    <Location /members>
        SetHandler perl-script
        PerlAccessHandler  Calce::CheckCLA
    </Location>


Entire startup.pl:

    use lib qw(/data/software/www/mp/lib);
    1;


Here's my handler (a work in progress):

    #
    # mod_perl handler to check whether user
    # has accepted the Calce Legal Agreement.
    #
    # Author: David Eisner
    # Date:   November 2007

    package Calce::CheckCLA;

    use strict;
    use warnings;

    use Apache2::RequestRec ();
    use Apache2::RequestIO ();
    use APR::Table ();
    use CGI::Cookie ();

    use Apache2::Const -compile => qw(FORBIDDEN OK REDIRECT);


    my $CLA_FORM = "/mp/legal?r=http://slashdot.org";;
    my $COOKIE = "ACCEPT_CLA";
    my $COOKIE_YES = "Y";

    sub handler {
        my $r = shift;

        my $cla_accepted = get_cookie_val($r);

        if ($cla_accepted eq "Y") {
            return Apache2::Const::OK;
        }
        else {
            $r->headers_out->set(Location => $CLA_FORM);
            $r->status(Apache2::Const::REDIRECT);

            return Apache2::Const::REDIRECT;
        }

        # return Apache2::Const::OK;
        # return Apache2::Const::FORBIDDEN;
    }


    sub get_cookie_val($) {
        my $r = shift;

        my $cla_accepted = 0;
        $r->subprocess_env();
        my %cookies = fetch CGI::Cookie;
        if ($cookies{$COOKIE}) {
            $cla_accepted = $cookies{$COOKIE}->value;
        }

        return $cla_accepted;
    }

    1;


2. Used Components and their Configuration:

*** mod_perl version 2.000003

*** using 
/data/software/perl/perl-5.8.8/lib/site_perl/5.8.8/sun4-solaris/Apache2/BuildConfig.pm

*** Makefile.PL options:
  MP_APR_LIB     => aprext
  MP_AP_PREFIX   => /data/software/www/apache-2.0.61
  MP_COMPAT_1X   => 1
  MP_DEBUG       => 1
  MP_GENERATE_XS => 1
  MP_LIBNAME     => mod_perl
  MP_TRACE       => 1
  MP_USE_DSO     => 1


*** The httpd binary was not found


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

 -L/data/software/www/apache-2.0.61/lib -laprutil-0 -lexpat
-L/data/software/www/apache-2.0.61/lib
 -L/data/software/www/apache-2.0.61/lib -lapr-0 -lsendfile -lrt -lm
-lsocket -lnsl -lresolv  -lpthread -ldl



*** /data/software/perl/perl-5.8.8/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=solaris, osvers=2.9, archname=sun4-solaris
    uname='sunos cannes.umd.edu 5.9 generic_122300-08 sun4u sparc
sunw,ultra-30 '
    config_args=''
    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='/opt/SUNWspro/bin/cc', ccflags =' -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
    optimize='-O',
    cppflags=''
    ccversion='Sun C 5.8 Patch 121015-01 2006/01/26', gccversion='',
gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='/opt/SUNWspro/bin/cc', ldflags =' -L/usr/lib -L/usr/ccs/lib
-L/afs/glue.umd.edu/software/sunstudio/11/SUNWspro/prod/lib/v8plus
-L/afs/glue.umd.edu/software/sunstudio/11/SUNWspro/prod/lib -L/lib '
    libpth=/usr/lib /usr/ccs/lib
/afs/glue.umd.edu/software/sunstudio/11/SUNWspro/prod/lib/v8plus
/afs/glue.umd.edu/software/sunstudio/11/SUNWspro/prod/lib /lib
    libs=-lsocket -lnsl -ldl -lm -lc
    perllibs=-lsocket -lnsl -ldl -lm -lc
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-KPIC', lddlflags='-G -L/usr/lib -L/usr/ccs/lib
-L/afs/glue.umd.edu/software/sunstudio/11/SUNWspro/prod/lib/v8plus
-L/afs/glue.umd.edu/software/sunstudio/11/SUNWspro/prod/lib -L/lib'


Characteristics of this binary (from libperl):
  Compile-time options: PERL_MALLOC_WRAP USE_LARGE_FILES USE_PERLIO
  Built under solaris
  Compiled at Nov 13 2007 15:43:13
  %ENV:
    PERL_LWP_USE_HTTP_10="1"
  @INC:
    /data/software/perl/perl-5.8.8/lib/5.8.8/sun4-solaris
    /data/software/perl/perl-5.8.8/lib/5.8.8
    /data/software/perl/perl-5.8.8/lib/site_perl/5.8.8/sun4-solaris
    /data/software/perl/perl-5.8.8/lib/site_perl/5.8.8
    /data/software/perl/perl-5.8.8/lib/site_perl
    .

*** Packages of interest status:

Apache2            : -
Apache2::Request   : -
CGI                : 3.15
ExtUtils::MakeMaker: 6.36
LWP                : 5.808
mod_perl           : -
mod_perl2          : 2.000003


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

[I attached gdb to the httpd process before it segfaulted.]

(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0xfec4368c in XS_Apache2__RequestRec_send_cgi_header (cv=0x24ed38) at
/export/data/software/www/build/mod_perl-2.0.3/WrapXS/Apache2/Response/Response.xs:149
149         mpxs_Apache2__RequestRec_send_cgi_header(r, buffer);
Current language:  auto; currently minimal
(gdb) bt
#0  0xfec4368c in XS_Apache2__RequestRec_send_cgi_header (cv=0x24ed38)
at 
/export/data/software/www/build/mod_perl-2.0.3/WrapXS/Apache2/Response/Response.xs:149
#1  0xfeddc0b8 in Perl_pp_entersub () from
/data/software/www/apache/modules/mod_perl.so
#2  0xfedd2944 in Perl_runops_standard () from
/data/software/www/apache/modules/mod_perl.so
#3  0xfed6f918 in Perl_call_sv () from
/data/software/www/apache/modules/mod_perl.so
#4  0xfed43320 in modperl_callback (handler=0x1f69d8, p=0x220008,
r=0x220040, s=0xefbb0, args=0x2c8d10) at modperl_callback.c:101
#5  0xfed43eec in modperl_callback_run_handlers (idx=6, type=4,
r=0x220040, c=0x0, s=0xefbb0, pconf=0x0, plog=0x0, ptemp=0x0,
run_mode=MP_HOOK_RUN_FIRST)
    at modperl_callback.c:262
#6  0xfed445d0 in modperl_callback_per_dir (idx=6, r=0x220040,
run_mode=MP_HOOK_RUN_FIRST) at modperl_callback.c:371
#7  0xfed3cbb4 in modperl_response_handler_run (r=0x220040, finish=0)
at mod_perl.c:995
#8  0xfed3cf3c in modperl_response_handler_cgi (r=0x220040) at mod_perl.c:1090
#9  0x0007590c in ap_run_handler (r=0x220040) at config.c:153
#10 0x000765d4 in ap_invoke_handler (r=0x220040) at config.c:364
#11 0x0005442c in ap_process_request (r=0x220040) at http_request.c:249
#12 0x0004b594 in ap_process_http_connection (c=0x21a100) at http_core.c:253
#13 0x0008bb1c in ap_run_process_connection (c=0x21a100) at connection.c:43
#14 0x0008c138 in ap_process_connection (c=0x21a100, csd=0x21a028) at
connection.c:176
#15 0x000732ac in child_main (child_num_arg=0) at prefork.c:610
#16 0x000734d8 in make_child (s=0xefbb0, slot=0) at prefork.c:704
#17 0x000738c0 in perform_idle_server_maintenance (p=0xeb410) at prefork.c:839
#18 0x00073f48 in ap_mpm_run (_pconf=0xeb410, plog=0x1234f0,
s=0xefbb0) at prefork.c:1040
#19 0x0007f138 in main (argc=3, argv=0xffbff71c) at main.c:636



This report was generated by ./mp2bug on Thu Nov 15 18:50:55 2007 GMT.

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

Note: Complete the rest of the details and post this bug report to
modperl <at> perl.apache.org. To subscribe to the list send an empty
email to [EMAIL PROTECTED]

Reply via email to