perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <ge...@modperlcookbook.org>
Subject Re: per-server cleanups core dump? geoff?
Date Tue, 30 Nov 2004 17:36:40 GMT

>> but now that I'm thinking about it, the interpreter is fully destroyed on
>> restarts, right?  that is, a PerlModule will fully load a module both on
>> start _and_ on restart.  this wasn't true on static builds in mp1,
>> which is
>> why it was necessary to schedule code callbacks at restart.
>>
>> for instance, a restart callback could clear a cache or update a global
>> httpd.conf mtime.  but if PerlModule re-executes module init code on
>> restart
>> then that could be the mechansim.  we just couldn't rely on that in
>> mp1 so
>> we had to use a per-server cleanup.
> 
> 
> You mean we don't need to do anything special? Or what do you exactly
> suggest that we provide?

well, I was kind of wondering out loud if we needed to provide per-server
cleanups like we did in mp1.

the main reason we needed them (as far as I can see) was for performing
cleanup work when a server was re-started.  but we may not need a special
hook for this in mp2. consider the following (off the top of my head):

  my $mtime = -M $httpd.conf;

  sub handler {
     ... uses $mtime ...
  }

now, in mp1 $mtime is calculated only on server start for common static
builds.  it is not re-calculated on server restart unless you are using dso
or PerlFreshRestart.  but httpd.conf might be edited between start and
restart, so you would maintain an accurate mtime with something like

  my $mtime = -M $httpd.conf;
  Apache->server->register_cleanup(sub { $mtime = -M $httpd.conf });

that was mp1.  but I seem to recall that the interpreter is _always_ broken
down in mp2, in which case the initial example _will_ reset $mtime on each
restart via PerlModule.  if this is true, then people could use a much
simpler idiom to perform similar activities, such as initializing caches or
whatnot.

I'm not saying that we need or should abandon per-server cleanups, since I
may be missing a use that cannot fit easily into the latter paradigm.  but
if most people have an alternative then it move from showstopper to "nice to
have."

HTH

--Geoff


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


Mime
View raw message