Java Mailing List Archive

http://www.apache-httpd.com/

Home » modperl.perl »

Re: Killing oversized Perl processes

Perrin Harkins

2010-03-11

Replies: Find Java Web Hosting

Author LoginPost Reply
On Thu, Mar 11, 2010 at 4:41 PM, ARTHUR GOLDBERG <artg@(protected):
> 2) Kill apache httpd processes occasionally, to control the effect of slow
> perl memory leaks. I'll do this by setting MPM Worker MaxRequestsPerChild to
> some modest value. (I'll try 100.)

You definitely should be doing that, and possibly running
Apache2::SizeLimit as well. There's plenty of documentation about
this on the site.

> OK, that kills big processes. What happens next is that Perl runs out of
> memory (outputs "Out of Memory!") and calls the __DIE__ signal handler. So,
> my plan is to catch the signal, redirect the browser to an error page, and
> finally kill the process.

A simpler solution would be to set something in $r->notes from your
DIE handler and use that in an apache error page handler to determine
what to show.

Also, be careful with using a universal DIE handler, since it kills
exception handling in code that uses eval {} blocks.

> How
> does one determine whether -DPERL_EMERGENCY_SBRK is defined, and if one does
> that does STDOUT still work?

It's really not much different from what you're already doing, but you
can check your compile options with perl -V.

- Perrin
©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.