At 11:13 -0800 11/26/03, Stas Bekman wrote:
Elizabeth Mattijsen wrote:
I was wondering whether the following trick could somehow work with mod_perl 2. And excuse my preference for prefork MPM's: I guess that's the hammer to work on all my nails (pun intended). I'm open to other solutions to this "problem"!
Liz, when you are talking about prefork mpm, you get a better chance to get more people to read your question if you don't mention mp2. My guess is that folks won't even try to reply, since they aren't familiar with mp2. But your question applies to mp1 just as well.
I'll keep that in mind next time... but I was under the impression that I could only do this in MP2 because that's where there is a Perl*Handler running in the parent for each request, or sequence of request in the case of Keep-Alive. To my knowledge, you can't do that in MP1, or can you?
Which Perl*Handlers you are talking about? There are twice as many of them in MP2. All Perl*Handlers from mp1, but ChildInit/Exit run during the request. If you are talking about the parent process, the one which has spawned the child processes, there is no hook running in it during the request, it has no idea the child is doing anything at all, besides the limited info provided by the scoreboard.
When you're using prefork MPM, you try to create as many constant data-structures as possible before the children are being forked. Sometimes, these structures require updating during the lifetime of the server, but the updated information does not need to be available to all the currently running children. And/Or you don't want the server to be completely restarted for that. An example would be a blacklist of IP-numbers that you want to block, or indexes that only need updating if a new entry is added.
If I remember correctly, you mentioned this to me back at YAPC::Paris in July. But back then you said you are going to gracefully restart the child processes, after updating the parent's data so that the newly spawned processes will see the updated info. It won't work in any other way.
Having to gracefully restart is what I'm trying to prevent, really. My experience so far with grceful restarts hasn't been very favourable. Was I wrong?
I have no idea. You were the one who suggested this solution back in July and you said that it just worked, when I said that I was skeptical about it ;)
If you are talking about serving HTTP, you probably want PerlInitHandler. Similar to Apache::Reload.
But PerlInitHandler runs in the child, does it not?
They all run in the child. The only hooks run by the parent process that spawns the child processes is PostConfig and OpenLogs, which happen at the server startup.
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html