Stas Bekman wrote:
Philippe M. Chiasson wrote:
Geoffrey Young wrote:
The keyword is the "not immediately" -- that solution will make Apache::SizeLimit and its clones unreliable. Since you will never be able to bracket the memory usage again.
That's incorrect. You will be able to bracket memory usage. In a prefork
MPM, calling $r->child_terminate() will kill off that child as soon as the
current request is done with, after running cleanups et all.
OK, so what's the difference from calling exit?
There are 2 major differences. First, you will get proper cleanup and all
pool cleanups will be run.
which can be arranged by making sure that it runs after all the other cleanups.
Second, you will get a child that gets to cleanly shutdown, however the child chooses to do that.
like what?
For a threaded MPM like prefork, we currently have no valid solution to
implement child_terminate() in order to reclaim memory. This way would at
least provide a partial solution. If a child grows to fat, calling $r->child_terminate()
would guarantee that that child will not serve new requests (keepalive issues exluded)
and kill itself off as soon as it can.
But it's very dangerous. Assume that you have N processes with M threads. If all processes will be scheduled to be killed, you will have a long long time w/o the server accepting any new requests.
No, no, only the child process will do that, the parent, and all the other siblings will keep on hapilly serving requests.
Sorry, but you didn't understand what I was trying to say. Let's say you have only one process with many threads. If that process grows too big (since you can't measure a size of a thread) it'll throw the TERM signal and then it'll block until all threads are done. Meanwhile no other new requests will be started. Or will the parent process spawn a new process as soon as its child receives SIGTERM? I can't see how the parent will know about it, before the child terminates.
Yup, I looked at that, but in 2.0, at the beginning of the lifetime of a child,
a private counter is set to MaxRequestsPerChild and decremented for each request.
Child termination is caused when that number reaches zero. So, changing MaxRequestPerChild
will not work that way anymore.
So any chance we can get hold of that counter?
Nope, most MPMs I looked at implement that as a local var.
So may be there is a need to expose it via a proper ap_ api?
-- __________________________________________________________________ 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
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]