You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philip M. Gollucci" <pg...@p6m7g8.com> on 2006/08/25 10:22:14 UTC

A2::SL -- sanity check please

Hi All,

in t/apache2/basic.t

I seem to have hit a snag, I'd like to get someone to verify it before I rip my hair out trying to fix it.

in the 1.x series,
        my $handlers = $r->get_handlers('PerlCleanupHandler');
        is( scalar @$handlers, 0,
            'there is no PerlCleanupHandler before add_cleanup_handler()' );

        Apache::SizeLimit->add_cleanup_handler($r);

in the 2.x series,
        ### XXX: mp1 / mp2 API difference
        # http://perl.apache.org/docs/2.0/api/Apache2/RequestUtil.html#Synopsis
        #
        my @handlers = @{ $r->get_handlers('PerlCleanupHandler') || [] };
        is( scalar @handlers, 0,
            'there is no PerlCleanupHandler before add_cleanup_handler()' );

        Apache2::SizeLimit->add_cleanup_handler($r);

FIRST, notice the API difference....

SECOND, the second time you call

@handlers = @{ $r->get_handlers('PerlCleanupHandler') || [] };
        is( scalar @handlers, 1,
            'there is one PerlCleanupHandler after add_cleanup_handler()' );

IT SEGFAULTS!

Witness the fruits of my labor and gdb 6.5 able to attach to httpd during startup on FreeBSD!
There is a PR
http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/100067
for this, but they've not committed it yet -- I'll ping them.

(gdb) bt
#0  0x28426ad1 in strlen () from /lib/libc.so.6
#1  0x287e2fbb in Perl_newSVpv (s=0x0, len=0) at sv.c:6885
 av_push(av, newSVpv(handler->name, 0));

#2  0x2871a67e in modperl_handler_perl_get_handlers (handp=0x82c6e6c, p=0x82c6018) at modperl_handler.c:584
#3  0x288fbeb2 in mpxs_Apache2__RequestRec_get_handlers (r=0x82c6050, name=0x8a82880 "PerlCleanupHandler")
    at
/usr/home/pgollucci/dev/compile/freebsd-6.1-stable/3.4.4/mod_perl/r436693-5.8.8-2.2.3-prefork/xs/Apache2/RequestUtil/Apache2__RequestUtil.h:48
#4  0x288fdc08 in XS_Apache2__RequestRec_get_handlers (cv=0x8a7b570) at RequestUtil.xs:146
#5  0x287d3820 in Perl_pp_entersub () at pp_hot.c:2877
#6  0x287b407d in Perl_runops_debug () at dump.c:1459
#7  0x2875f93d in S_call_body (myop=0xbfbfdef0, is_eval=0 '\0') at perl.c:2731
#8  0x2875f4f2 in Perl_call_sv (sv=0x8a168b8, flags=4) at perl.c:2646
#9  0x287186a3 in modperl_callback (handler=0x82a32c0, p=0x82c6018, r=0x82c6050, s=0x80baeb8, args=0x825a450)
    at modperl_callback.c:100
#10 0x28718d9d in modperl_callback_run_handlers (idx=6, type=4, r=0x82c6050, c=0x0, s=0x80baeb8, pconf=0x0, plog=0x0,
    ptemp=0x0, run_mode=MP_HOOK_RUN_FIRST) at modperl_callback.c:261
#11 0x28719174 in modperl_callback_per_dir (idx=6, r=0x82c6050, run_mode=MP_HOOK_RUN_FIRST) at modperl_callback.c:368
#12 0x287147a8 in modperl_response_handler_run (r=0x82c6050, finish=1) at mod_perl.c:994
#13 0x28714899 in modperl_response_handler (r=0x82c6050) at mod_perl.c:1034
#14 0x08077276 in ap_run_handler (r=0x82c6050) at config.c:157
#15 0x080779f6 in ap_invoke_handler (r=0x82c6050) at config.c:371
#16 0x08085630 in ap_process_request (r=0x82c6050) at http_request.c:258
#17 0x08082a38 in ap_process_http_connection (c=0x82ba128) at http_core.c:184
#18 0x0807e8d2 in ap_run_process_connection (c=0x82ba128) at connection.c:43
#19 0x0807ed10 in ap_process_connection (c=0x82ba128, csd=0x82ba050) at connection.c:178
#20 0x0808aac2 in child_main (child_num_arg=0) at prefork.c:640
#21 0x0808ac62 in make_child (s=0x80baeb8, slot=0) at prefork.c:736
#22 0x0808acd5 in startup_children (number_to_start=1) at prefork.c:754
#23 0x0808b0fd in ap_mpm_run (_pconf=0x80b9018, plog=0x80e7018, s=0x80baeb8) at prefork.c:975
#24 0x080622be in main (argc=7, argv=0xbfbfe394) at main.c:717

Worst case,
$r->pool->cleanup_register(\&exit_if_too_big, $r);
doesn't break get_handlers in 2.x




-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

"In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night."
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /
 / /|_/ / // /\ \/ /_/ / /__
/_/  /_/\_, /___/\___\_\___/
       <___/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: A2::SL -- sanity check please

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> in the 2.x series,
>         ### XXX: mp1 / mp2 API difference

yucko?  who came up with that great idea?

;)


> SECOND, the second time you call
> 
> @handlers = @{ $r->get_handlers('PerlCleanupHandler') || [] };
>         is( scalar @handlers, 1,
>             'there is one PerlCleanupHandler after add_cleanup_handler()' );
> 
> IT SEGFAULTS!

verified.  yucko.

> (gdb) bt
> #0  0x28426ad1 in strlen () from /lib/libc.so.6
> #1  0x287e2fbb in Perl_newSVpv (s=0x0, len=0) at sv.c:6885
>  av_push(av, newSVpv(handler->name, 0));
> 
> #2  0x2871a67e in modperl_handler_perl_get_handlers (handp=0x82c6e6c, p=0x82c6018) at modperl_handler.c:584
> #3  0x288fbeb2 in mpxs_Apache2__RequestRec_get_handlers (r=0x82c6050, name=0x8a82880 "PerlCleanupHandler")
>     at
> /usr/home/pgollucci/dev/compile/freebsd-6.1-stable/3.4.4/mod_perl/r436693-5.8.8-2.2.3-prefork/xs/Apache2/RequestUtil/Apache2__RequestUtil.h:48
> #4  0x288fdc08 in XS_Apache2__RequestRec_get_handlers (cv=0x8a7b570) at RequestUtil.xs:146

looks the same as mine.

I wonder if the root cause isn't trying to push an anonymous subroutine
onto the stack in SizeLimit.pm?  reaching back into the depths of my
memory, anyonymous subs seem to have just started working one day, well
before anyone implemented them...

--Geoff

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org