Exiting process doesn't trigger ErrorDocument 500

--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

<html><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; ">Hello =
All<div><br></div><div>Resending, as nobody =
replied.</div><div><br></div><div>Is there a way to get a mod_perl =
process that dies with "out of memory" trapped by =
the "ErrorDocument 500" handler?<div><br></div><div>I'm running =
Perl programs in mod_perl in Apache (2.2) on RHEL, using the prefork =
MPM.</div><div>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 <span =
class=3D"Apple-style-span" style=3D"font-family: Verdana; font-size: =
13px; "><a =
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</a></span>. Processes =
that grow to large die with "Out of Memory!" and "Callback called =
exit."</div><div>I had hoped to give some users some feedback via =
Apache's <a =
href=3D"http://httpd.apache.org/docs/2.0/mod/core.html#error document">Erro=
rDocument</a> (also described in <a =
href=3D"http://httpd.apache.org/docs/2.0/custom-error.html"> Custom Error =
Response</a>). While that can run local Perl (in a new process of =
course) as in the example</div><div><div><font =
size=3D"+1"><code>       </code></font><span =
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; "><span class=3D"Apple-style-span" style=3D"font-family: 'Courier =
New', Courier, monospace; font-size: 19px; line-height: 20px; =
">ErrorDocument 500 =
/cgi-bin/crash-recover.pl</span></span></div></div><div>exiting process =
doesn't trigger ErrorDocument 500. </div><div>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.</div><div><br></div><div>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?</div><div><br></div><div>BR</div><div>A</div><div><br></div></div></b=
ody></html>=

--Apple-Mail-1-1059129363--
ArthurG [ Mo, 22 März 2010 17:50 ] [ ID #2035975 ]

Re: Exiting process doesn't trigger ErrorDocument 500

On Mon, Mar 22, 2010 at 12:50 PM, ARTHUR GOLDBERG <artg [at] cs.nyu.edu> 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.

--
Eric Covener
covener [at] gmail.com

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
Eric Covener [ Mo, 22 März 2010 21:21 ] [ ID #2035980 ]

Re: Exiting process doesn't trigger ErrorDocument 500

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 <artg [at] cs.nyu.edu>
> 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 [at] gmail.com
>


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
ArthurG [ Di, 23 März 2010 19:00 ] [ ID #2036109 ]
Webserver » gmane.comp.apache.user » Exiting process doesn't trigger ErrorDocument 500

Vorheriges Thema: configure one file with multiple mime types?
Nächstes Thema: [Tips] How to Dynamically Limit Access to a folder based on its name and Apache SSL Session Variable