Hello,

I'm getting segfaults when I use module which has an END {} block
as PerlOpenLogsHandler or PerlPostConfigHandler with Devel::Cover.
I found the problem when I used DBI in my PerlOpenLogsHandler but
even small module with an END block shows the same behaviour.

Here's what I have:

Makefile.PL:

        use ExtUtils::MakeMaker;
        use Apache::TestMM qw(clean test);
        Apache::TestMM::filter_args();
        Apache::TestMM::generate_script('t/TEST');
        WriteMakefile(
                NAME => 'mod_perl-end-devel-cover-test',
                PREREQ_PM => {
                        'Apache2::Const' => 0,
                        'Test' => 0,
                        'Test::More' => 0,
                        'Devel::Cover' => 0,
                },
        );

lib/TestEND.pm:

        package TestEND;
        sub handler {
                return 0;
        }
        END { print STDERR "END\n"; }
        1;
        __END__

t/conf/extra.conf.in:

        PerlSwitches -...@serverroot@/../lib
        PerlOpenLogsHandler TestEND

t/1.t:

        use Test;
        plan tests => 1;
        ok(1);

t/TEST.PL:

        use Apache::TestRunPerl ();
        Apache::TestRunPerl->new->run(@ARGV);

I can run make test just fine. When I run make testcover TEST_VERBOSE=1,
I get

        waiting 60 seconds for server to start: .[  error] 
        server has died with status 255 (please examine t/logs/error_log)
        [  error] oh nuts, server dumped core 
        [  error] for stacktrace, run: gdb /usr/sbin/httpd -core 
/home/adelton/project/mod_perl-end-devel-cover/core.14876
        sh: line 1: 14749 Terminated              /usr/bin/perl 
/home/adelton/project/mod_perl-end-devel-cover/t/TEST -one-process -bugreport 
-verbose=1

The backtrace is

        #0  Perl_pp_entersub (my_perl=0x24a61b8) at pp_hot.c:2643
        #1  0x010a5cf3 in Perl_call_sv (my_perl=0x24a61b8, sv=0x20, flags=6) at 
perl.c:2653
        #2  0x00a19b3e in modperl_perl_call_list (my_perl=0x24a61b8, 
subs=0x29d8d94, name=0xa3d281 "END") at modperl_util.c:483
        #3  0x00a26068 in modperl_perl_call_endav (my_perl=0x24a61b8) at 
modperl_perl.c:199
        #4  0x00a260c5 in modperl_perl_destruct (perl=0x24a61b8) at 
modperl_perl.c:142
        #5  0x00a0f725 in modperl_interp_destroy (interp=0x24cfff8) at 
modperl_interp.c:146
        #6  0x00a0f7e1 in modperl_interp_pool_destroy (data=0x249e2c0) at 
modperl_interp.c:202
        #7  0x0069ead9 in run_cleanups () at memory/unix/apr_pools.c:2306
        #8  apr_pool_destroy (pool=0x24a21c0) at memory/unix/apr_pools.c:774
        #9  0x0069ed98 in apr_pool_clear (pool=0x2333638) at 
memory/unix/apr_pools.c:728
        #10 0x009be6b0 in main (argc=1650552405, argv=0xbf8e85c4) at 
/usr/src/debug/httpd-2.2.11/server/main.c:690

and the error_log has

        [Fri May 15 21:20:21 2009] [notice] SELinux policy enabled; httpd 
running as context unconfined_u:unconfined_r:unconfined_t:s0
        END

So the END block is executed but the restart of the apache server
(the one which happens after PerlPostConfigHandler) fails. The problem
does not occur when the module is used as PerlHandler. The problem
does not occur without Devel::Cover.

The versions of software are

        httpd-2.2.11-2.fc10.i386
        mod_perl-2.0.4-7.i386
        perl-5.10.0-68.fc10.i386
        perl-Devel-Cover-0.64-1.fc10.i386

-- I'm using packages from Fedora 10, not compiled by myself.

Have you got any hints what could be the problem or where to
start looking for the cause of the segfault?

Thanks,

-- 
Jan Pazdziora

Reply via email to