Re: a possible bug with Apache::Server::ReStarting
On Tue, 18 Jan 2000, Doug MacEachern wrote: On Wed, 19 Jan 2000, Stas Bekman wrote: Why? Some users need a control of what gets reloaded and what not on server start (Yes I know if you put in startup.pl file it loads only once) For example parsing and loading some heavy xml files... Why do you want to take it away? I think PerlRestartHandler is a better solution in most cases. and inside Perl sections you can always do it on your own: Perl do_something() unless $My::Init++ /Perl Sure I'm cringing at global variables in general looking forwared to threaded 2.0. do you have a concrete example that requires $Apache::Server::{Starting,ReStarting} ? You can get away with internal tracking like you did above with $My::Init, but IMHO it's not a clean approach. How about adding a new method that will return the server status. No global variables needed. do {} if Apache::server_status() == Apache::Constant::Starting; So you can add other modes like, Starting|Restarting|Running|HavingLunch|Stopping|Dyeing. The examples are: * Start/Restart - when some heavy startup operation should be performed (e.g. a heavy XML parsing and preloading like someone posted awhile ago) * Stopping - I wrote this runaway watchdog and had to make it a standalone program which has no idea whether the server is running. I wanted the code to be aware of the server status and spawn from the startup file, and kill it when the server is stopping... I guess I can provide more cleanup scenarios too. ___ Stas Bekmanmailto:[EMAIL PROTECTED] http://www.stason.org/stas Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC perl.apache.orgmodperl.sourcegarden.org perlmonth.comperl.org single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
Re: a possible bug with Apache::Server::ReStarting
Hi, While documenting the 'restart twice on start' apache's behavior, I've tested $Apache::Server::ReStarting and $Apache::Server::Starting. Perl section is executed twice -- OK. startup.pl is executed once -- OK. $Apache::Server::ReStarting never gets set! - I suppose it's a bug. (I have tried Apache::Server::ReStarting and Apache::ServerReStarting which is the same... I've even tried Apache::Server::Restarting and Apache::ServerRestarting - I know they don't exist) Meanwhile the only workaround is: ReStarting == true if Starting == false Here is the test that you can reproduce: I've added: httpd.conf: -- Perl print STDERR "Perl Apache::Server::Starting is true \n" if $Apache::Server::Starting; print STDERR "Perl Apache::Server::Starting is false \n" unless $Apache::Server::Starting; print STDERR "Perl Apache::Server::ReStarting is true \n" if $Apache::Server::ReStarting; print STDERR "Perl Apache::Server::ReStarting is false \n" unless $Apache::Server::ReStarting; /Perl startup.pl: --- print STDERR "startup.pl: Apache::Server::Starting is true \n" if $Apache::Server::Starting; print STDERR "startup.pl: Apache::Server::Starting is false \n" unless $Apache::Server::Starting; print STDERR "startup.pl: Apache::Server::ReStarting is true \n" if $Apache::Server::ReStarting; print STDERR "startup.pl: Apache::Server::ReStarting is false \n" unless $Apache::Server::ReStarting; when server is started startup.pl: Apache::Server::Starting is true startup.pl: Apache::Server::ReStarting is false Perl Apache::Server::Starting is true Perl Apache::Server::ReStarting is false and in the error_log: Perl Apache::Server::Starting is false Perl Apache::Server::ReStarting is false I'm running the latest CVS (both mod_perl and apache) version on linux with perl5.00503 if it matters. BTW, Doug -- a wish list: I think we need four states: 1. Starting 2. Restarting 3. Running 4. Stopping I needed the 'Stopping' flag for the runwaway processes watchdog if you remember. probably other cleanup and alerting features can be added using the 'stopping' flag. Regarding implementation -- it can be a single variable, with four states. Thanks! ___ Stas Bekmanmailto:[EMAIL PROTECTED] http://www.stason.org/stas Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC perl.apache.orgmodperl.sourcegarden.org perlmonth.comperl.org single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
Re: a possible bug with Apache::Server::ReStarting
On Wed, 19 Jan 2000, Stas Bekman wrote: Why? Some users need a control of what gets reloaded and what not on server start (Yes I know if you put in startup.pl file it loads only once) For example parsing and loading some heavy xml files... Why do you want to take it away? I think PerlRestartHandler is a better solution in most cases. and inside Perl sections you can always do it on your own: Perl do_something() unless $My::Init++ /Perl I'm cringing at global variables in general looking forwared to threaded 2.0. do you have a concrete example that requires $Apache::Server::{Starting,ReStarting} ?