perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew O'Brien" <andr...@oriel.com.au>
Subject RE: Question re preloading embperl and apache shutdown
Date Thu, 24 Jul 2008 04:44:56 GMT

Hi Neil,

> I am now using Apache2.2, mod_perl 2 and Embperl 2.3. I am also 
> preloading my Embperl code via startup.pl, and finding that 
> "apachectl 
> stop" seems to call my preload routine even when shutting 
> down apache, 
> which makes it take an absurdly long time to cycle the server when I 
> change code. This didn't use to happen with apache1.3. Is 
> anyone aware 
> of a way to detect from within startup.pl whether we are 
> starting up or 
> shutting down? Then I guess I could skip the preload myself if we're 
> stopping... any ideas? I'm using apache, mod_perl and Embperl 
> built from 
> tarball sources.

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;

Cheers,

Andrew


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


Mime
View raw message