Help -- how can I make the Apache process die at the end of the request?

Help -- how can I make the Apache process die at the end of the request?

am 04.12.2008 22:06:52 von Victor Danilchenko

I need to do it forcibly, no matter what happens during the request. I
have to slightly relax security constraints to call an unusual
subrequest, and since I cannot guarantee that the cleanup code will be
reached (what if the subrequest is terminated by the client, or dies on
a bug?), I figure my best bet it to make sure that at the end of the
request execution, the current apache process dies so that a new one can
be spawned. 'kill $$' is obviously inadequate.

Does anyone have any idea how this can be achieved? perhaps utilizing
MaxRequestsPerChild somehow, I could trick the parent process into
terminating this one after the request completes? or is there some
mod_perl feature which tells mod_perl to not re-use the perl runtime in
a given process?

Any help and/or ideas are much appreciated. Thanks in advance.

--
Victor Danilchenko
Senior Software Engineer, AskOnline.net
victor@askonline.net - 617-273-0119

Re: Help -- how can I make the Apache process die at the end of therequest?

am 04.12.2008 22:15:58 von Adam Prime

Victor Danilchenko wrote:
> I need to do it forcibly, no matter what happens during the request.
> I have to slightly relax security constraints to call an unusual
> subrequest, and since I cannot guarantee that the cleanup code will be
> reached (what if the subrequest is terminated by the client, or dies on
> a bug?), I figure my best bet it to make sure that at the end of the
> request execution, the current apache process dies so that a new one can
> be spawned. 'kill $$' is obviously inadequate.
>
> Does anyone have any idea how this can be achieved? perhaps
> utilizing MaxRequestsPerChild somehow, I could trick the parent process
> into terminating this one after the request completes? or is there some
> mod_perl feature which tells mod_perl to not re-use the perl runtime in
> a given process?
>
> Any help and/or ideas are much appreciated. Thanks in advance.
>

$r->child_terminate()

mp2:
http://perl.apache.org/docs/2.0/api/Apache2/RequestUtil.html #C_child_terminate_

mp1:
http://perl.apache.org/docs/1.0/guide/snippets.html#Terminat ing_a_Child_Process_on_Request_Completion

Adam

Re: Help -- how can I make the Apache process die at the end of therequest?

am 09.12.2008 20:26:00 von Victor Danilchenko

Adam Prime wrote:
> Victor Danilchenko wrote:
>> I need to do it forcibly, no matter what happens during the
>> request. I have to slightly relax security constraints to call an
>> unusual subrequest, and since I cannot guarantee that the cleanup code
>> will be reached (what if the subrequest is terminated by the client,
>> or dies on a bug?), I figure my best bet it to make sure that at the
>> end of the request execution, the current apache process dies so that
>> a new one can be spawned. 'kill $$' is obviously inadequate.
>>
>> Does anyone have any idea how this can be achieved? perhaps
>> utilizing MaxRequestsPerChild somehow, I could trick the parent
>> process into terminating this one after the request completes? or is
>> there some mod_perl feature which tells mod_perl to not re-use the
>> perl runtime in a given process?
>>
>> Any help and/or ideas are much appreciated. Thanks in advance.
>>
>
> $r->child_terminate()
>
> mp2:
> http://perl.apache.org/docs/2.0/api/Apache2/RequestUtil.html #C_child_terminate_

Perfect. Much thanks.

--
Victor Danilchenko
Senior Software Engineer, AskOnline.net
victor@askonline.net - 617-273-0119