Re: Killing oversized Perl processes

Perrin Harkins <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On Thu, Mar 11, 2010 at 4:41 PM, ARTHUR GOLDBERG <[email protected]> wrote:
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.