perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Gunton <n...@nilspace.com>
Subject Re: Question re preloading embperl and apache shutdown
Date Thu, 24 Jul 2008 15:25:18 GMT
Andrew O'Brien wrote:
> Hi Neil,
>  
> A start in apache is actually a start+restart IIRC. Could that be what
> you're seeing? I posted this a few days back but perhaps it was lost in
> the noise. I've got the following in my startup.pl:
> 
> use Apache2::ServerUtil;
> # We want to do this only when the sever restarts. (The start process
> # includes a restart). The below variable has a value of 1 during
> # server start/stop and a value greater than one during the second
> # phase of server starting and any graceful restart.
> if ( Apache2::ServerUtil::restart_count() > 1 ) {
>   # force load/initialise perl stuff
> }
> 
> Are any of the following useful to you (even if you set a variable using
> the shutdown callback to forcibly stop the preload?) in
> Apache2::ServerUtil?
> 
>    # register server shutdown callback
>    Apache2::ServerUtil::server_shutdown_register_cleanup(sub {
> Apache2::Const::OK });
> 
>    # do something only when the server restarts
>    my $cnt = Apache2::ServerUtil::restart_count();
>    do_something_once() if $cnt > 1;

Thanks, Andrew, that's very useful. I have added the test for 
restart_count(), and the server starts up a lot faster. I guess I was 
preloading twice or something. However, it hasn't changed the length of 
time the server takes to shutdown. I don't think it's actually calling 
the startup.pl code to do this... I'm not sure what it's doing. 
Basically I call "apachectl_perl stop" (this is for the mod_perl 
backend, I build two versions - one for backend mod_perl, and 
httpd_proxy for reverse proxy). When I do this, most of the httpd_perl 
processes go away, but one is left hanging there for about 20 seconds. 
In the meantime, I cannot restart, because the port is in use. I do seem 
to remember when I was having issues with Embperl processing my TABLE 
and TR tags, then those errors would appear again when I issued the stop 
command. I believe this is what led me to believe that the startup is 
being called at shutdown too. But now I don't think so - at least, not 
my code. I am wondering now if Embperl is maybe doing the preload itself 
again, internally, at shutdown. I'll try to look into it some more, 
maybe do some tracing via logging to see what's going on. Meantime, I am 
still fighting fires with my recent server upgrade - Embperl 2.3 has 
royally screwed up my forms handling, it seems. Apparently fdat is being 
handled differently with respect to setting variables in the code which 
were previously then included in [$ hidden $], but no more. I really 
thought Embperl 2 would be more stable by this point!

Thanks again,

Neil

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


Mime
View raw message