Exiting process doesn"t trigger ErrorDocument 500

Exiting process doesn"t trigger ErrorDocument 500

am 22.03.2010 17:50:21 von ArthurG

--Apple-Mail-1-1059129363
Content-Type: text/plain;
charset=US-ASCII;
format=flowed;
delsp=yes
Content-Transfer-Encoding: 7bit

Hello All

Resending, as nobody replied.

Is there a way to get a mod_perl process that dies with "out of
memory" trapped by the "ErrorDocument 500" handler?

I'm running Perl programs in mod_perl in Apache (2.2) on RHEL, using
the prefork MPM.
I want to protect my server against Perl processes that grow much too
large, as they can slow or even freeze the system. So I've setup an
address space resource limit via Perl's Apache2::SizeLimit. Processes
that grow to large die with "Out of Memory!" and "Callback called exit."
I had hoped to give some users some feedback via Apache's
ErrorDocument (also described in Custom Error Response). While that
can run local Perl (in a new process of course) as in the example
ErrorDocument 500 /cgi-bin/crash-recover.pl
exiting process doesn't trigger ErrorDocument 500.
Alternatively, I tried to output status to users via a SIG handler for
__DIE__, but STDERR is closed by the time the SIG handler runs.

Is there a way to configure this, or another way to provide some error
output to a browser that sent a Request that caused the server process
to die?

BR
A


--Apple-Mail-1-1059129363
Content-Type: text/html;
charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

-webkit-line-break: after-white-space; ">Hello =
All


Resending, as nobody =
replied.

Is there a way to get a mod_perl =
process that dies with "out of memory" trapped by =
the "ErrorDocument 500" handler?

I'm running =
Perl programs in mod_perl in Apache (2.2) on RHEL, using the prefork =
MPM.
I want to protect my server against Perl processes that =
grow much too large, as they can slow or even freeze the system. So I've =
setup an address space resource limit via Perl's  class=3D"Apple-style-span" style=3D"font-family: Verdana; font-size: =
13px; "> href=3D"http://search.cpan.org/%7Egozer/mod_perl-2.0.4/docs/ api/Apache2/Si=
zeLimit.pod" id=3D"j:1-" =
title=3D"Apache2::SizeLimit">Apache2::SizeLimit
. Processes =
that grow to large die with "Out of Memory!" and "Callback called =
exit."
I had hoped to give some users some feedback via =
Apache's  href=3D"http://httpd.apache.org/docs/2.0/mod/core.html#error document">Erro=
rDocument
 (also described in  href=3D"http://httpd.apache.org/docs/2.0/custom-error.html"> Custom Error =
Response
). While that can run local Perl (in a new process of =
course) as in the example
size=3D"+1">        class=3D"Apple-style-span" style=3D"border-collapse: separate; color: =
rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 20px; =
font-style: normal; font-variant: normal; font-weight: normal; =
letter-spacing: normal; line-height: normal; orphans: 2; text-indent: =
0px; text-transform: none; white-space: normal; widows: 2; word-spacing: =
0px; "> New', Courier, monospace; font-size: 19px; line-height: 20px; =
">ErrorDocument 500 =
/cgi-bin/crash-recover.pl
exiting process =
doesn't trigger ErrorDocument 500. 
Alternatively, I =
tried to output status to users via a SIG handler for __DIE__, but =
STDERR is closed by the time the SIG handler =
runs.

Is there a way to configure this, or =
another way to provide some error output to a browser that sent a =
Request that caused the server process to =
die?

BR
A

ody>=

--Apple-Mail-1-1059129363--

Re: Exiting process doesn"t trigger ErrorDocument 500

am 22.03.2010 21:21:48 von Eric Covener

On Mon, Mar 22, 2010 at 12:50 PM, ARTHUR GOLDBERG wrote:
> Is there a way to get a mod_perl process that dies with "out of memory"
> trapped by the=A0"ErrorDocument 500" handler?

If it crashes, it's too late. If it's actually perl pre-empting the
crash, then it ought to work. The key is whether you get a 500 or a
crash OOTB, which is unclear.

--=20
Eric Covener
covener@gmail.com

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Exiting process doesn"t trigger ErrorDocument 500

am 23.03.2010 19:00:01 von ArthurG

I set rlimit AS to protect against 'runaway' processes that allocate
too much VM so Perl dies with "Out of Memory".
The __DIE__ handler is called, but it cannot write to STDOUT (which is
connected to the TCP connection to the client) because STDOUT has been
closed.
is there something else I have the handler do so that Apache httpd
sees a 500?

BR
A


On Mar 22, 2010, at 4:21 PM, Eric Covener wrote:

> On Mon, Mar 22, 2010 at 12:50 PM, ARTHUR GOLDBERG
> wrote:
>> Is there a way to get a mod_perl process that dies with "out of
>> memory"
>> trapped by the "ErrorDocument 500" handler?
>
> If it crashes, it's too late. If it's actually perl pre-empting the
> crash, then it ought to work. The key is whether you get a 500 or a
> crash OOTB, which is unclear.
>
> --
> Eric Covener
> covener@gmail.com
>


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org