Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

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

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


victor at askonline

Dec 4, 2008, 1:06 PM

Post #1 of 3 (522 views)
Permalink
Help -- how can I make the Apache process die at the end of the request?

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 [at] askonline - 617-273-0119


adam.prime at utoronto

Dec 4, 2008, 1:15 PM

Post #2 of 3 (489 views)
Permalink
Re: Help -- how can I make the Apache process die at the end of the request? [In reply to]

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

Adam


victor at askonline

Dec 9, 2008, 11:26 AM

Post #3 of 3 (456 views)
Permalink
Re: Help -- how can I make the Apache process die at the end of the request? [In reply to]

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 [at] askonline - 617-273-0119

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.