perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fred Moyer <f...@redhotpenguin.com>
Subject Re: Apache::DBI
Date Wed, 22 Jul 2009 08:42:18 GMT
On Tue, Jul 21, 2009 at 8:39 PM, Adam Prime<adam.prime@utoronto.ca> wrote:
> Adam Prime wrote:
>> What I wanted to do was fix this issue:
>>
>> http://rt.cpan.org/Public/Bug/Display.html?id=36346
>>
>> either by checking the various server starting variables for each of the
>> apis, or simply throwing an eval around the push_handler.
>
> I've been looking into this bug a bit tonight, and it seems to me that
> the problem is maybe with restart_count.
>
> This code:
>
> if (Apache2::ServerUtil::restart_count() == 1) {
>    debug(2, "$prefix skipping connection during server startup, read
> the docu !!");
>    return $drh->connect(@args);
> }
>
> appears earlier in the connect function, and based on the comments, it
> would appear that any connection to the database that happens during
> startup (which to me should mean any time before the end of the
> ChildInitPhase) should not be cached. The problem is PostConfig is run
> twice on startup, once with restart_count == 1, and once with
> restart_count == 2.  So the second time through, it gets past that if
> statement, and blows up when it hits the code that tries to push_handler().
>
> The documentation here is also no longer true:
>
> http://perl.apache.org/docs/2.0/api/Apache2/ServerUtil.html#C_restart_count_
>
> If I put that code into my startup.pl, i get:
>
> cnt: 1
> cnt: 2
> cnt: 3
> cnt: 4
> cnt: 5
> cnt: 6
> cnt: 7
>
> I'm going to fool around with things a bit more.

Looks like we have a unit test for part of restart_count:


phred@harpua ~/dev/svn/modperl/mod_perl-2.0 $ ack restart_count t/
t/conf/post_config_startup.pl
110:    #    my $cnt = Apache2::ServerUtil::restart_count();

t/htdocs/vhost/post_config.pl
6:$TestVhost::config::restart_count = Apache2::ServerUtil::restart_count();

t/response/TestAPI/server_util.pm
59:    ok t_cmp Apache2::ServerUtil::restart_count, 2, "restart count";

t/response/TestVhost/config.pm
21:our $restart_count;
37:        ok t_cmp($restart_count, 2, "PerlPostConfigRequire");

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


Mime
View raw message