You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Mod_perl Mailing List <mo...@hotresponse.com> on 2001/12/12 01:25:48 UTC

Re(2): Apache::SizeLimit Exit is Delayed

perrin@elem.com writes:
>> I'm using Apache::SizeLimit (on both Solaris and Linux) and getting the
>> error_log entry:
>>
>> [Tue Dec 11 15:01:19 2001] (2520) Apache::SizeLimit httpd process too
>big,
>> exiting at SIZE=44964 KB  SHARE=10900 KB  REQUESTS=389  LIFETIME=9505
>> seconds
>>
>> But the child process often doesn't exit right away.  It may hang around
>> for a couple of minutes or even an hour with the message occuring with
>> every hit:
>
>Maybe this is because of a keep-alive connection.  It's possible that
>Apache::exit() waits for all keep-alive activity to complete before
>exiting.
>Is there any way you can test it without keep-alive?
>
>- Perrin
>
Hi Perrin,

That was it.  The child exited immediately when I hit the limit with
KeepAlive Off.  Now the question is:  Is there a way to force an exit even
with KeepAlive On?

Thanks!

Bob


Re: Apache::SizeLimit Exit is Delayed

Posted by Ged Haywood <ge...@www2.jubileegroup.co.uk>.
Hi there,

On Thu, 13 Dec 2001, Igor Sysoev wrote:

> On Thu, 13 Dec 2001, Perrin Harkins wrote:
> 
> > How about sending Stas a patch for the guide with information on this?  It
> > might be useful to other BSD'ers.
> 
> My English is too poor for it.

Send it to me then. :)

73,
Ged.


Re: Apache::SizeLimit Exit is Delayed

Posted by Igor Sysoev <is...@rambler-co.ru>.
On Thu, 13 Dec 2001, Perrin Harkins wrote:

> > > You should use it in an early phase, like PerlFixupHandler.  It pushes a
> > > cleanup handler if it needs to exit.  It will not exit until after the
> > > request is done.
> >
> > I didn't know it. I think you should document it.
> > But any way I think it's better to check size in cleanup.
> 
> I agree and I plan to change this.
> 
> > It's BSD specific module. It allow to set login class for process
> > to limit memory or time usage.
> 
> How about sending Stas a patch for the guide with information on this?  It
> might be useful to other BSD'ers.

My English is too poor for it.

Igor Sysoev


Re: Apache::SizeLimit Exit is Delayed

Posted by Perrin Harkins <pe...@elem.com>.
> > You should use it in an early phase, like PerlFixupHandler.  It pushes a
> > cleanup handler if it needs to exit.  It will not exit until after the
> > request is done.
>
> I didn't know it. I think you should document it.
> But any way I think it's better to check size in cleanup.

I agree and I plan to change this.

> It's BSD specific module. It allow to set login class for process
> to limit memory or time usage.

How about sending Stas a patch for the guide with information on this?  It
might be useful to other BSD'ers.

- Perrin


Re: Apache::SizeLimit Exit is Delayed

Posted by Igor Sysoev <is...@rambler-co.ru>.
On Thu, 13 Dec 2001, Perrin Harkins wrote:

> > And some recomendation - I'm using Apache::SizeLimit as
> > PerlCleanupHandler - so Apache would exit after request is completed.
> 
> You should use it in an early phase, like PerlFixupHandler.  It pushes a
> cleanup handler if it needs to exit.  It will not exit until after the
> request is done.

I didn't know it. I think you should document it.
But any way I think it's better to check size in cleanup.

> > I'm using mod_class for mod_perl size hard control during reponse phase.
> 
> I've never heard of mod_class.  Do you have a link for it?

It's BSD specific module. It allow to set login class for process
to limit memory or time usage.

mod_class:
ftp://ftp.lexa.ru/pub/apache-rus/contrib/mod_class.c

There is more early module - mod_setclass:
http://www.apache.org/dist/httpd/contrib/modules/1.3/mod_setclass.c

The main difference - mod_setclass sets login class for each Apache
child while mod_class sets class for main Apache process.
mod_setclass is better to set time restriction - with mod_class
you need to restart main Apache every day (it's common practice
to rotate logs) otherwise main Apache can exhaust time limit.

> My official recommendation is to set Apache::SizeLimit up with low enough
> numbers that you can handle it if it grows a little more during the final
> request, and use Apache::Resource as a hard limit to prevent runaway
> processes from eating up all your RAM.  Apache::Resource will kill your
> process even if it's in the middle of a response, so you don't want to use
> it for normal size control.

mod_class and mod_setclass make the same on BSD.

Igor Sysoev


Re: Apache::SizeLimit Exit is Delayed

Posted by Perrin Harkins <pe...@elem.com>.
> Some bug report about Apache::SizeLimit diagnostic:
>
> I don't know about Linux and Solaris but under
> FreeBSD shared memory shows some incredible numbers:

Okay, I'll ask the guy who wrote the *BSD support to look into it.  I don't
have a FreeBSD system to test with.

> And some recomendation - I'm using Apache::SizeLimit as
> PerlCleanupHandler - so Apache would exit after request is completed.

You should use it in an early phase, like PerlFixupHandler.  It pushes a
cleanup handler if it needs to exit.  It will not exit until after the
request is done.

> I'm using mod_class for mod_perl size hard control during reponse phase.

I've never heard of mod_class.  Do you have a link for it?

My official recommendation is to set Apache::SizeLimit up with low enough
numbers that you can handle it if it grows a little more during the final
request, and use Apache::Resource as a hard limit to prevent runaway
processes from eating up all your RAM.  Apache::Resource will kill your
process even if it's in the middle of a response, so you don't want to use
it for normal size control.

- Perrin


Re: Apache::SizeLimit Exit is Delayed

Posted by Igor Sysoev <is...@rambler-co.ru>.
On Wed, 12 Dec 2001, Perrin Harkins wrote:

> > what about 
> > 
> > $r->headers_out->add(Connection => 'close');
> 
> Good idea!  I'll put that into a future release.

Some bug report about Apache::SizeLimit diagnostic:

I don't know about Linux and Solaris but under
FreeBSD shared memory shows some incredible numbers:

Apache::SizeLimit httpd process too big, exiting at SIZE=25092 KB
SHARE=1823412 KB  REQUESTS=79  LIFETIME=293 seconds

I think that it due to rusage.ru_ixrss is integral value and it should
be divided (but I don't know where to find divisor).

And some recomendation - I'm using Apache::SizeLimit as
PerlCleanupHandler - so Apache would exit after request is completed.
mod_perl usually grows at response phase so exiting in fixup is not
very usefull.
I'm using mod_class for mod_perl size hard control during reponse phase.

Igor Sysoev


Re: Apache::SizeLimit Exit is Delayed

Posted by Perrin Harkins <pe...@elem.com>.
> what about 
> 
> $r->headers_out->add(Connection => 'close');

Good idea!  I'll put that into a future release.
- Perrin


Re: Apache::SizeLimit Exit is Delayed

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Perrin Harkins wrote:
> 
> > That was it.  The child exited immediately when I hit the limit with
> > KeepAlive Off.  Now the question is:  Is there a way to force an exit
> even
> > with KeepAlive On?
> 
> As Jay already pointed out, you usually don't want KeepAlive on with
> mod_perl.  However, you could try changing the call
> $r->child_terminate() to Apache::exit().  If this seems to work better
> for you, let me know and I'll consider changing this in a future release
> of Apache::SizeLimit.

what about 

$r->headers_out->add(Connection => 'close');

IIRC someone pointed out recently (well, 6 months ago :) that that
would work...

--Geoff

Re: Re(2): Apache::SizeLimit Exit is Delayed

Posted by Perrin Harkins <pe...@elem.com>.
> That was it.  The child exited immediately when I hit the limit with
> KeepAlive Off.  Now the question is:  Is there a way to force an exit
even
> with KeepAlive On?

As Jay already pointed out, you usually don't want KeepAlive on with
mod_perl.  However, you could try changing the call
$r->child_terminate() to Apache::exit().  If this seems to work better
for you, let me know and I'll consider changing this in a future release
of Apache::SizeLimit.

- Perrin


Re: Re(2): Apache::SizeLimit Exit is Delayed

Posted by Jay Thorne <ja...@grue.userfriendly.org>.
On December 11, 2001 04:25 pm, Mod_perl Mailing List wrote:
>
> Hi Perrin,
>
> That was it.  The child exited immediately when I hit the limit with
> KeepAlive Off.  Now the question is:  Is there a way to force an exit even
> with KeepAlive On?
>
> Thanks!
>
> Bob

For what its worth, I'd recommend KeepAlive Off for almost any mod_perl 
deployment. It basically is a waste of memory and a process slot. Especially 
if you put graphics on a separate server.

-- 
Jay "yohimbe" Thorne  yohimbe@userfriendly.org
Mgr Sys & Tech, Userfriendly.org