Re: Apache::SizeLimit Exit is Delayed

2001-12-13 Thread Igor Sysoev

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

2001-12-13 Thread Geoffrey Young


 
 Geoff wrote:
 what about 
 
 $r-headers_out-add(Connection = 'close');
 
 I tried each of these changes in turn.  Neither worked to 
 immediately exit
 the child.  I never saw that either of them would exit the 
 child at all
 but I may not have kept them running long enough. 

hmph...  are you running Apache::SizeLimit as a PerlCleanupHandler?  then,
of course, this particular fix won't work...

just curious, mainly.  that _should_ work...

--Geoff



Re: Apache::SizeLimit Exit is Delayed

2001-12-13 Thread Perrin Harkins

 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

2001-12-13 Thread Perrin Harkins

 Perrin Harkins wrote:
 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.

 Geoff wrote:
 what about
 
 $r-headers_out-add(Connection = 'close');

 I tried each of these changes in turn.  Neither worked to immediately exit
 the child.  I never saw that either of them would exit the child at all
 but I may not have kept them running long enough.

Did you see more requests being handled by the same process?

 I noticed an odd pattern of behavior.   With one of our cgi scripts, and
 using $r-child_terminate(), the child would always exit immediately.
 With other scripts, it wouldn't exit.  With both Perrin's and Geoff's
 suggestions from above, that same script would cause the process being
 used to be changed, but the old process wouldn't exit.

You mean the old process hangs around, but doesn't take any new requests?

- Perrin




Re: Apache::SizeLimit Exit is Delayed

2001-12-13 Thread Igor Sysoev

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

2001-12-13 Thread Perrin Harkins

  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

2001-12-13 Thread Igor Sysoev

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

2001-12-13 Thread Ged Haywood

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

2001-12-12 Thread Geoffrey Young

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: Apache::SizeLimit Exit is Delayed

2001-12-12 Thread Perrin Harkins

 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

2001-12-12 Thread Mod_perl Mailing List

Hi Jay, Perrin, and Geoff,

Thanks for your thoughts on this problem.

Jay yohimbe Thorne wrote:
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.

My setup uses a mod_backhand hack for single host accelerating, And I'm
using KeepAlive On based on this advice from Theo Schlossnagle.  It's been
working great for many months.

Theo Schlossnagle wrote (on 2/22/2001):
Also, be sure to turn on KeepAlives on the mod_perl server! You will no
longer run out of children and mod_backhand will keep pools of open
connections so that you don't have to reconnect for every request. 

Perrin Harkins wrote:
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.

Geoff wrote:
what about 

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

I tried each of these changes in turn.  Neither worked to immediately exit
the child.  I never saw that either of them would exit the child at all
but I may not have kept them running long enough. 

I noticed an odd pattern of behavior.   With one of our cgi scripts, and
using $r-child_terminate(), the child would always exit immediately. 
With other scripts, it wouldn't exit.  With both Perrin's and Geoff's
suggestions from above, that same script would cause the process being
used to be changed, but the old process wouldn't exit.

We're going to try to figure out what is happening with this and I'll
report back if we do.

Thanks again for your help!

Bob




Re: Apache::SizeLimit Exit is Delayed

2001-12-11 Thread Perrin Harkins

 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