You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Pierpaolo Fumagalli <ia...@iname.com> on 1998/06/18 00:33:31 UTC

Fw: Apache and the new mod_jserv.c

I'm VERY sorry for popping-in in such a RUDE way and in such a FAST way but
Brian Behlendorf told me to post my request to your list...
Thank you and sorry again.
    Pier

From: Brian Behlendorf <br...@hyperreal.org>
Date: Wednesday, June 17, 1998 10:31 PM
Subject: Re: Apache and the new mod_jserv.c


>
>I don't have the time right now to answer this - could you ask on
new-httpd?
>
> Brian
>
>At 10:13 PM 6/17/98 +0200, Pierpaolo Fumagalli wrote:
>>Hi Brian...
>>    Stefano suggested to talk and ask directly to you (rather than throug
>>the list) so some problems I am facing while writing the mod_jserv for
>>Apache...
>>
>>Problems I met are regarding the initialization and shutdown of Apache web
>>server, I mean, if I am able to get when a module is initialised, (init
call
>>in module), I am not able to catch when a module is supposed to shutdown.
>>I ran thru all Apache 1.3b6 and Apache 1.3 source but I was not able to
see
>>a signal, an api, anyting (except from unix signals, but they are not
>>implemented under Win32) that could return me or could call the module
when
>>the server is dying.
>>
>>I need to know when the server is shutting down to close handles and free
up
>>some threads/processes/sockets/vars. For example:
>>If when apache starts as a service under Win32 in the init of mod_jserv I
>>fire up the JVM, allocate 1 or more sockets for AJPv2 and create a
>>controlling thread for checking when the JVM crashes. When apache shuts
down
>>it just clears the memory, but I also need to close handles to processes
and
>>threads, because if not they remain in memory, in terminated state, but
>>preventing the Service Control Manager to free memory and release apache
>>processes.
>>
>>This happens (I hope) only under Win32, since in other systems modules can
>>set up some sighandler, do things on signals, and then calling/restoring
>>default apache signal handlers.
>>
>>Of course, there is something I am not seeing (I am not a SKILLED C
>>programmer, I come from assembler development), could you please help me?
>>As soon as I have seen there's nothing around, and it should be easy for
the
>>Apache Group to come to a solution (a module_exit - like you do with
child:
>>child_init and child_exit...).
>>
>>Thank you very much for your patience...
>>    Pier
>>
>>P.S. I also had an idea, setting up a counter via child_init / child_exit:
>>child_init increases a int value, and child_exit decreases it. when this
>>gets back to 0 in child_exit i call all cleanup functions, but I don't
think
>>it's a "clean" idea... what could happen if a child just dies?
>>
>>
>>
>>
>>
>>
>--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
>pure chewing satisfaction                                  brian@apache.org
>                                                        brian@hyperreal.org
>


Re: Fw: Apache and the new mod_jserv.c

Posted by Dean Gaudet <dg...@arctic.org>.
Use register_cleanup on the pool passed to your module's init() function.

Dean

On Thu, 18 Jun 1998, Pierpaolo Fumagalli wrote:

> I'm VERY sorry for popping-in in such a RUDE way and in such a FAST way but
> Brian Behlendorf told me to post my request to your list...
> Thank you and sorry again.
>     Pier
> 
> From: Brian Behlendorf <br...@hyperreal.org>
> Date: Wednesday, June 17, 1998 10:31 PM
> Subject: Re: Apache and the new mod_jserv.c
> 
> 
> >
> >I don't have the time right now to answer this - could you ask on
> new-httpd?
> >
> > Brian
> >
> >At 10:13 PM 6/17/98 +0200, Pierpaolo Fumagalli wrote:
> >>Hi Brian...
> >>    Stefano suggested to talk and ask directly to you (rather than throug
> >>the list) so some problems I am facing while writing the mod_jserv for
> >>Apache...
> >>
> >>Problems I met are regarding the initialization and shutdown of Apache web
> >>server, I mean, if I am able to get when a module is initialised, (init
> call
> >>in module), I am not able to catch when a module is supposed to shutdown.
> >>I ran thru all Apache 1.3b6 and Apache 1.3 source but I was not able to
> see
> >>a signal, an api, anyting (except from unix signals, but they are not
> >>implemented under Win32) that could return me or could call the module
> when
> >>the server is dying.
> >>
> >>I need to know when the server is shutting down to close handles and free
> up
> >>some threads/processes/sockets/vars. For example:
> >>If when apache starts as a service under Win32 in the init of mod_jserv I
> >>fire up the JVM, allocate 1 or more sockets for AJPv2 and create a
> >>controlling thread for checking when the JVM crashes. When apache shuts
> down
> >>it just clears the memory, but I also need to close handles to processes
> and
> >>threads, because if not they remain in memory, in terminated state, but
> >>preventing the Service Control Manager to free memory and release apache
> >>processes.
> >>
> >>This happens (I hope) only under Win32, since in other systems modules can
> >>set up some sighandler, do things on signals, and then calling/restoring
> >>default apache signal handlers.
> >>
> >>Of course, there is something I am not seeing (I am not a SKILLED C
> >>programmer, I come from assembler development), could you please help me?
> >>As soon as I have seen there's nothing around, and it should be easy for
> the
> >>Apache Group to come to a solution (a module_exit - like you do with
> child:
> >>child_init and child_exit...).
> >>
> >>Thank you very much for your patience...
> >>    Pier
> >>
> >>P.S. I also had an idea, setting up a counter via child_init / child_exit:
> >>child_init increases a int value, and child_exit decreases it. when this
> >>gets back to 0 in child_exit i call all cleanup functions, but I don't
> think
> >>it's a "clean" idea... what could happen if a child just dies?
> >>
> >>
> >>
> >>
> >>
> >>
> >--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
> >pure chewing satisfaction                                  brian@apache.org
> >                                                        brian@hyperreal.org
> >
> 
> 


Re: Fw: Apache and the new mod_jserv.c

Posted by Rasmus Lerdorf <ra...@lerdorf.on.ca>.
Couldn't you just use the register_cleanup() function to register the
function that cleans up after your module?  Apache will call this function
when appropriate.

-Rasmus