perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: [PATCH] Re: [BUG] Bad refcounting in Apache->push_handlers()
Date Thu, 07 Apr 2005 19:42:33 GMT
Dominique Quatravaux wrote:
>>Any chance you could add a test to the modperl2 test suite that I can 
>>reproduce the problem with?
> I finally got around to doing that, sorry for the delay. Here is a new
> test case, with inspiration from TestHooks::inlined_handlers.
> Warning: since Apache->server->push_handlers() needs to operate at the
> global server-config level, once this patch is applied, the *entire*
> test suite mostly stops working :-] However, I am confident that once
> the bug is gone this patch will no longer be intrusive, because when I
> un-inline the sub (there is a commented-out line to that effect in the
> test case file), the test suite passes correctly as a whole.

Dominique, your test case had a bug, fixed as following:

- sub { test_waz_zere });
+ sub { &test_waz_zere });

or  sub { test_waz_zere(@_) });

also I did some updates for the recent changes in mp2 API, the whole test is at the end.

Now with threaded perl 5.8.6 everything works fine, but:
t/directive/perlrequire fails with: can't find ANONSUB top entry (get)

with non-threaded 5.6.1 a bunch of tests fail with:
Undefined subroutine &main::ÿÿÿÿÿÿÿÿÿÿÿÿÿ called, <DATA> line 462.

so I'll be looking at those cases.

Thanks for the test case!

package TestHooks::inlined_handlers_server_wide;

# this test exercises Apache handlers as anonymous subs, installed
# using Apache->server->push_handlers() at mod_perl initialization
# time.
# Previously there was a refcounting bug there, similar to the
# one described in

use strict;
use warnings FATAL => 'all';

use Apache2::RequestIO ();
use Apache2::ServerUtil ();
use Apache2::Const -compile => qw(OK DECLINED);

our $answer = "not ok 1\n";

sub test_waz_zere {
    my ($r) = @_;
    $r->notes->set("test_waz_zere", 1);

## This works (non-inlined handler):
#    Apache2->server->push_handlers(PerlFixupHandler => \&test_waz_zere );
## This did not work as of Subversion r159573:
    Apache2::ServerUtil->server->push_handlers(PerlFixupHandler => 
                                               sub { test_waz_zere(@_) });
} }

sub handler {
    my $r = shift;

    $r->print($r->notes->get("test_waz_zere") ? "ok 1\n" :
             "not ok 1\n");

    PerlModule TestHooks::inlined_handlers_server_wide
  <Location /TestHooks__inlined_handlers_server_wide>
      SetHandler modperl
      PerlResponseHandler TestHooks::inlined_handlers_server_wide

Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message